Size of the frame to be set a little bit larger than content

Assignment Help JAVA Programming
Reference no: EM13941683

I need the size of the frame to be set a little bit larger than its content, which is a label. Also, the location could be set so that it could be appeared not at the upper left corner of the screen. And we can set the foreground and background color of the label.

import javax.swing.*;
import java.util.*;

public class helloWorldSwing {

private static void createAndShowGUI() {

//Make sure we have nice window decorations.

JFrame.setDefaultLookAndFeelDecorated(true);

//Create and set up the window.

JFrame frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Add the ubiquitous "Hello World" label.

JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);

//Display the window.
frame.pack();
frame.setVisible(true);
}

public static void main(String[] args) {

//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}

Reference no: EM13941683

Questions Cloud

What does a merchant wholesaler do : What does a merchant wholesaler do?
Project planning process pyramid : Project Planning Process Pyramid Why do many people like to start at the bottom of the pyramid for the project planning process instead of at the top?
What ensure to there no instances of reverse discrimination : Is it more important for criminal-justice leaders to be ethical than leaders in business because monetary ambition and a cutthroat mentality can have benefits in business while they can only lead to corruption in criminal justice? Explain.
Four steps in market research process : 1. List the four steps in market research process? 2. Describe in some detail the three types of research that are typically used in business environment and any specific areas of research interest to business?
Size of the frame to be set a little bit larger than content : I need the size of the frame to be set a little bit larger than its content, which is a label. Also, the location could be set so that it could be appeared not at the upper left corner of the screen. And we can set the foreground and background co..
How much do you need to invest : If you are 35, want to retire in 30 years and be able to withdraw $50,000.00 for each year in retirement, and expect to live to age 85, how much do you need to invest at 9.5% each year(to the nearest dollar)(5 points)?
Discuss the possible causes of the accident : Discuss the possible causes of the accident. What are the steps one should have followed in order to avoid the disaster? Should international corporations be engaged in the production of such toxic materials for profit
Communication channel for urgent messages : How effective is email as a communication channel for urgent messages? How do the strengths and weaknesses of the email channel impact the internal communication of urgent messages? How do employees perceive urgent email information?
What is the difference between a felony and a misdemeanor : What is the difference between a felony and a misdemeanor - What is the State's burden of proof in a criminal case?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd