GUI and Thread

S

Sameer

Related to java GUI
------------------------

I have designed a frame which contains a TextArea ,TextField and a
JButton.
It is going to act as a Personal Messages Window in a chatting program.
The size of the frame is set to 300 X 300.
When I start the JFrame instance it shows the Window but does not show
any component, i have to strech it little bit to show all the
components.

To avoid this, I execute a pack() routine on the frame, but then
all the components of the frame gets collected in one part of the
frame.
This is because there is not content in the TextArea and TextField.
I want to display the frame in full form i.e. having size 300 X 300 all
the time. I know that this is happening due to the routine pack().

How to avoid this so as to display a full window?



Can I design a frame with Close button only i.e. without Minimize and
Maximize button? Is it possible to control display of Control buttons
in Swing?




Related to Thread Issues
-------------------------------
I open a new JFrame in a new Thread from a java program (which is also
a JFrame).

The class definition for this new JFrame application to be opened is

public class Chat extends JFrame implements Runnable {
..........
}

When i dispose the Frame, will this new thread be get killed?
Or it continue to use system resources?

How to kill a particular thread from a JVM when there are so many
threads running simeltaneously?

-Sameer
 
P

Paul van Rossem

Related to java GUI
------------------------

I have designed a frame which contains a TextArea ,TextField and a
JButton.
It is going to act as a Personal Messages Window in a chatting program.
The size of the frame is set to 300 X 300.
When I start the JFrame instance it shows the Window but does not show
any component, i have to strech it little bit to show all the
components.

To avoid this, I execute a pack() routine on the frame, but then
all the components of the frame gets collected in one part of the
frame.
This is because there is not content in the TextArea and TextField.
I want to display the frame in full form i.e. having size 300 X 300 all
the time. I know that this is happening due to the routine pack().

How to avoid this so as to display a full window?

Call setVisible(true) /after/ adding all components to your JFrame.
If you have to add components to your JFrame /after/ making it visible,
then you have to call revalidate().
Can I design a frame with Close button only i.e. without Minimize and
Maximize button? Is it possible to control display of Control buttons
in Swing?

The easiest way is to use a JDialog instead of a JFrame.
Related to Thread Issues

Are you sure you need to open the JFrame in a new Thread? This would
normally not be necessary and only adds this complication you described.

Paul.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Kotlin Thread 0
Supercollider Thread 1
How do I make the buttons on this GUI work? 10
basic GUI question 32
Retrieving data from software GUI 0
GUI 14
GUI question 5
java mail and thread 4

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,216
Latest member
topweb3twitterchannels

Latest Threads

Top