本文整理了Java中javax.swing.JFrame.setPreferredSize()
方法的一些代码示例,展示了JFrame.setPreferredSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.setPreferredSize()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:setPreferredSize
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void actionPerformed(ActionEvent e){
Dimension preferred = frame.getPreferredSize();
frame.setPreferredSize(new Dimension(0, 0));
frame.pack();
frame.setPreferredSize(preferred);
}
});
代码示例来源:origin: osmdroid/osmdroid
public static void main(final String[] args) {
final JFrame j = new OSMMapTilePackagerUI();
j.setPreferredSize(new Dimension(640, 400));
j.setDefaultCloseOperation(EXIT_ON_CLOSE);
j.pack();
j.setVisible(true);
}
代码示例来源:origin: stackoverflow.com
public Main()
frame.setPreferredSize(new Dimension(600, 400));
frame.setLayout(new BorderLayout());
frame.add(lpane, BorderLayout.CENTER);
代码示例来源:origin: 4thline/cling
errorWindow.setPreferredSize(new Dimension(900, 400));
errorWindow.addWindowListener(new WindowAdapter() {
@Override
代码示例来源:origin: wildfly/wildfly
public void start() throws Exception {
mainFrame=new JFrame("Chat demo");
mainFrame.setPreferredSize(new Dimension(600,600));
mainFrame.setBackground(Color.white);
mainFrame.addWindowListener(new WindowAdapter() {
代码示例来源:origin: stackoverflow.com
JEditorPane jep = new JEditorPane();
jep.setEditable(false);
try {
jep.setPage("http://www.yoursite.com");
}catch (IOException e) {
jep.setContentType("text/html");
jep.setText("<html>Could not load</html>");
}
JScrollPane scrollPane = new JScrollPane(jep);
JFrame f = new JFrame("Test HTML");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(scrollPane);
f.setPreferredSize(new Dimension(800,600));
f.setVisible(true);
代码示例来源:origin: RaiMan/SikuliX2
Element where = new Element(fSize).getCentered();
frame.setLocation(where.x, where.y);
frame.setPreferredSize(fSize);
frame.pack();
frame.setVisible(true);
代码示例来源:origin: knowm/XChart
frame.setPreferredSize(preferredSize);
frame.setSize(preferredSize);
frame.setVisible(true);
代码示例来源:origin: stackoverflow.com
private static void createWindowWithText(final String text) {
final JFrame popup = new JFrame();
popup.setPreferredSize(new Dimension(600,450));
//Add in whatever components you want
popup.pack();
popup.setLocationRelativeTo(null);
popup.setVisible(true);
}
代码示例来源:origin: ggp-org/ggp-base
private static void createAndShowGUI(Validator validatorPanel)
{
JFrame frame = new JFrame("Gdl Validator");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(1024, 768));
frame.getContentPane().add(validatorPanel);
frame.pack();
frame.setVisible(true);
}
代码示例来源:origin: stackoverflow.com
JFrame jframe=new JFrame();
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jframe.setPreferredSize(new Dimension(200,200));
Container content = jframe.getContentPane(); // Get the content pane
content.setLayout(new BorderLayout());
JButton jbutton=new JButton("a");
content.add(jbutton, BorderLayout.WEST);
jframe.pack();
jframe.setVisible(true);
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame();
frame.setContentPane( new JScrollPane( new TreeViewer( null, tree ) ) );
frame.setPreferredSize( new Dimension( 800, 600 ) );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setVisible( true );
代码示例来源:origin: antlr/antlrworks
public void setPreferredSize(Dimension size) {
if(useDesktop) {
jInternalFrame.setPreferredSize(size);
} else {
jFrame.setPreferredSize(size);
}
}
代码示例来源:origin: stackoverflow.com
public class Main{
public static void main(String[] args){
JFrame frame = new JFrame("Charlotte's Appletree Restaurant");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
CalculateBill newContentPane = new CalculateBill();
frame.getContentPane().add(newContentPane);
frame.setPreferredSize(new Dimension(300, 600));
frame.setVisible(true);
}
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame("Testing");
frame.setLayout(new FlowLayout()); // New line of code
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(1000, 2000)); // Modified line of code
frame.setBackground(Color.WHITE);
JPanel jp = new JPanel();
jp.setBackground(Color.BLUE);
jp.setPreferredSize(new Dimension(40, 40)); // Modified line of code
frame.add(jp);
frame.pack(); // added line of code
frame.setVisible(true);
代码示例来源:origin: stackoverflow.com
BrowserBox b = new BrowserBox();
GoButton g = new GoButton();
JFrame IDE = new JFrame("IDE");
IDE.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
IDE.setContentPane(b);
IDE.add(g);
IDE.setPreferredSize(new Dimension(200, 100));
IDE.pack();
IDE.setVisible(true);
代码示例来源:origin: datacleaner/DataCleaner
public static void main(final String[] args) {
LookAndFeelManager.get().init();
final JPanel comboPanel = new JPanel();
comboPanel.setLayout(new BorderLayout());
comboPanel.add(new DCComboBox<>(new String[] { "a", "b", "c" }), BorderLayout.NORTH);
final JFrame frame = new JFrame("test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(640, 480));
frame.add(comboPanel, BorderLayout.PAGE_START);
frame.pack();
frame.setVisible(true);
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-ui
public static void maxIt(JFrame jFrame) {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
Rectangle r = env.getMaximumWindowBounds();
Dimension d = r.getSize();
jFrame.setSize(d);
jFrame.setPreferredSize(d);
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-ui
public static void maxItWidth(JFrame jFrame) {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
Rectangle r = env.getMaximumWindowBounds();
Dimension d = r.getSize();
d.setSize(d.width, Math.min(d.height, jFrame.getPreferredSize().height));
jFrame.setSize(d);
jFrame.setPreferredSize(d);
}
代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client
public static void main(String[] argv) {
JFrame f = new JFrame();
VCFUploadApp app = new VCFUploadApp();
f.setPreferredSize(new Dimension(400, 400));
f.setMinimumSize(new Dimension(400, 400));
app.viewWillLoad();
f.add(app.getView());
f.pack();
f.show();
app.viewDidLoad();
}
内容来源于网络,如有侵权,请联系作者删除!