java - JFrame.setsize() not doing anything -


for reason, can't seem work:

public class app {      public static void main(string[] args){              jframe frame = new jframe("hi");             frame.setsize(300, 400);             frame.setdefaultcloseoperation(jframe.exit_on_close);             frame.setvisible(true);      } } 

no matter size pass setsize(), resulting window when run program still tiny. suggestions?

you try code,will jframe. , setprefered method in program

import java.awt.*; import java.awt.event.*; import javax.swing.*;  public class jframedemo {      public static void main(string s[]) {         jframe frame = new jframe("jframe source demo");         frame.addwindowlistener(new windowadapter() {             public void windowclosing(windowevent e) {                 system.exit(0);             }         });         jlabel jlbempty = new jlabel("");         jlbempty.setpreferredsize(new dimension(175, 100));         frame.getcontentpane().add(jlbempty, borderlayout.center);         frame.pack();         frame.setvisible(true);     } } 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -