Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
622 views
in Technique[技术] by (71.8m points)

java - To have a JFrame without adjusting for taskbar change

I need to have a JFrame, which when i change the window taskbar size or position, the frame shouldn't adjust itself. Which method of the JFrame will be called exactly on changing the taskbar size and position? Which method will I be required to override?

To put it in more clear words, By default the instance of JFrame will adjust its height and width by itself when I change the size and position of the window taskbar. But my JFrame shouldn't respond when I extend the window taskbar or when I change the taskbar from horizontal to vertical. It should remain in its default state.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

By using setResizable(false); Example:

import javax.swing.JFrame;


public class JavaApplication7 extends JFrame{

public static void main(String[] args) {
    JFrame frame = new JFrame("EG");
    frame.setVisible(true);
    frame.setResizable(false);
}
}

That creates a small JFrame named "EG" that can't be resized.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...