javax.swing.JFrame.setVisible()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(324)

本文整理了Java中javax.swing.JFrame.setVisible()方法的一些代码示例,展示了JFrame.setVisible()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.setVisible()方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:setVisible

JFrame.setVisible介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

public void run () {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setSize(480, 320);
    frame.setLocationRelativeTo(null);
    JPanel panel = new JPanel();
    frame.getContentPane().add(panel);
    panel.add(new NewSlider(200, 100, 500, 0.1f, 150, 300));
    frame.setVisible(true);
  }
});

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Timer timer = new Timer(1000, (ActionEvent e) -> {
  frame.setTitle(String.valueOf(System.currentTimeMillis()));
});
timer.setRepeats(true);
timer.start();
frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame ("Test");
JTextArea textArea = new JTextArea ("Test");

JScrollPane scroll = new JScrollPane (textArea, 
  JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

frame.add(scroll);
frame.setVisible (true);

代码示例来源:origin: apache/shiro

methodPanel.add(secureMethod3Button);
frame = new JFrame("Apache Shiro Sample Application");
frame.setSize(500, 200);
Container panel = frame.getContentPane();
panel.setLayout(new BorderLayout());
panel.add(logo, BorderLayout.NORTH);
panel.add(methodPanel, BorderLayout.SOUTH);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
  public void windowClosing(WindowEvent e) {

代码示例来源: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: jMonkeyEngine/jmonkeyengine

public void run(){
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    createFrame();
    currentPanel.add(canvas, BorderLayout.CENTER);
    frame.pack();
    startApp();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
});

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {
  JFrame frame = new TestScrollPane();
  JPanel panel = new JPanel();
  JTable table = new JTable();

  panel.setLayout(new BorderLayout());
  panel.add(new JLabel("NORTH"), BorderLayout.NORTH);
  panel.add(new JLabel("SOUTH"), BorderLayout.SOUTH);

  JScrollPane sp = new JScrollPane(table);
  sp.setBorder(BorderFactory.createEmptyBorder());
  panel.add(sp, BorderLayout.CENTER);
  frame.add(panel);

  frame.setVisible(true);
}

代码示例来源:origin: libgdx/libgdx

public void run () {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setSize(480, 320);
    frame.setLocationRelativeTo(null);
    JPanel panel = new JPanel();
    frame.getContentPane().add(panel);
    panel.add(new NewSlider(200, 100, 500, 0.1f, 150, 300));
    frame.setVisible(true);
  }
});

代码示例来源:origin: igniterealtime/Smack

private void createDebug() {
  frame = new JFrame("Smack Debug Window");
  frame.getContentPane().add(tabbedPane);
  frame.setSize(650, 400);
    frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {
  Runnable guiCreator = new Runnable() {
    public void run() {
      JFrame fenster = new JFrame("Hallo Welt mit Swing");
      fenster.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      fenster.setVisible(true);
    }
  };
  SwingUtilities.invokeLater(guiCreator);
}

代码示例来源:origin: libgdx/libgdx

public void run () {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setSize(480, 320);
    frame.setLocationRelativeTo(null);
    JPanel panel = new JPanel();
    frame.getContentPane().add(panel);
    panel.add(new Slider(200, 100, 500, 0.1f, 150, 300));
    frame.setVisible(true);
  }
});

代码示例来源:origin: marytts/marytts

public JFrame showInJFrame(String title, int width, int height, boolean allowZoom, boolean showControls, boolean exitOnClose) {
  final JFrame main = new JFrame(title);
  int mainWidth = width;
  JScrollPane scroll = new JScrollPane(this);
  main.getContentPane().add(scroll, BorderLayout.CENTER);
  final CursorDisplayer glass = new CursorDisplayer();
  main.setGlassPane(glass);
    JPanel zoomPanel = new JPanel();
    zoomPanel.setLayout(new BoxLayout(zoomPanel, BoxLayout.Y_AXIS));
    main.getContentPane().add(zoomPanel, BorderLayout.WEST);
    zoomPanel.add(Box.createVerticalGlue());
    JButton zoomIn = new JButton("Zoom In");
    zoomPanel.add(Box.createVerticalGlue());
  main.setSize(mainWidth, height);
  if (exitOnClose) {
    main.addWindowListener(new java.awt.event.WindowAdapter() {
  main.setVisible(true);
  this.requestFocus();
  return main;

代码示例来源:origin: libgdx/libgdx

public void run () {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setSize(480, 320);
    frame.setLocationRelativeTo(null);
    JPanel panel = new JPanel();
    frame.getContentPane().add(panel);
    panel.add(new Slider(200, 100, 500, 0.1f, 150, 300));
    frame.setVisible(true);
  }
});

代码示例来源:origin: marytts/marytts

public JFrame showInJFrame(String title, int width, int height, boolean allowZoom, boolean showControls, boolean exitOnClose) {
  final JFrame main = new JFrame(title);
  int mainWidth = width;
  JScrollPane scroll = new JScrollPane(this);
  main.getContentPane().add(scroll, BorderLayout.CENTER);
  final CursorDisplayer glass = new CursorDisplayer();
  main.setGlassPane(glass);
    JPanel zoomPanel = new JPanel();
    zoomPanel.setLayout(new BoxLayout(zoomPanel, BoxLayout.Y_AXIS));
    main.getContentPane().add(zoomPanel, BorderLayout.WEST);
    zoomPanel.add(Box.createVerticalGlue());
    JButton zoomIn = new JButton("Zoom In");
    zoomPanel.add(Box.createVerticalGlue());
  main.setSize(mainWidth, height);
  if (exitOnClose) {
    main.addWindowListener(new java.awt.event.WindowAdapter() {
  main.setVisible(true);
  this.requestFocus();
  return main;

代码示例来源:origin: knowm/XChange

@Override
 public void run() {
  // Create and set up the window.
  JFrame frame = new JFrame("XChart");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.add(chartPanel);
  // Display the window.
  frame.pack();
  frame.setVisible(true);
 }
});

代码示例来源:origin: igniterealtime/Smack

frame = new JFrame("Smack Debug Window -- " + connection.getXMPPServiceDomain() + ":" +
    connection.getPort());
menu.add(menuItem2);
frame.getContentPane().add(tabbedPane);
frame.setSize(550, 400);
frame.setVisible(true);

代码示例来源:origin: knowm/XChange

@Override
 public void run() {
  // Create and set up the window.
  JFrame frame = new JFrame("XChart");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.add(chartPanel);
  // Display the window.
  frame.pack();
  frame.setVisible(true);
 }
});

代码示例来源:origin: stackoverflow.com

private void makeGUI()
{
  final JFrame f = new JFrame();
  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  f.getContentPane().setLayout(new FlowLayout());

  // include: "class AnswerWorker" code here.
  // include: "JButton" b code here.

  f.getContentPane().add(b);
  f.getContentPane().add(new JButton("Nothing"));
  f.pack();
  f.setVisible(true);
}

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame("FooRendererTest");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(mainPanel); // or whatever...
frame.pack();
frame.setLocationRelativeTo(null);  // *** this will center your app ***
frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {
  JFrame frame = new JFrame("MyForm");
  frame.setContentPane(new MyForm().mainPanel);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.pack();
  frame.setVisible(true);
}

相关文章

JFrame类方法