/** * Tests out the panel from the command line. * * @param args ignored. */ public static void main(String[] args) { try { final JFrame jf = new JFrame("Generator Property Iterator"); jf.getContentPane().setLayout(new BorderLayout()); GeneratorPropertyIteratorPanel gp = new GeneratorPropertyIteratorPanel(); jf.getContentPane().add(gp, BorderLayout.CENTER); jf.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { jf.dispose(); System.exit(0); } }); jf.pack(); jf.setVisible(true); System.err.println("Short nap"); Thread.currentThread().sleep(3000); System.err.println("Done"); gp.setExperiment(new Experiment()); } catch (Exception ex) { ex.printStackTrace(); System.err.println(ex.getMessage()); } }
public static void main(String[] args) { if (Platform.get() != Platform.WINDOWS) throw new UnsupportedOperationException("This demo can only run on Windows."); LWJGLCanvas canvas = new LWJGLCanvas(); canvas.setSize(640, 480); JFrame frame = new JFrame("JAWT Demo"); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { canvas.destroy(); } }); KeyboardFocusManager.getCurrentKeyboardFocusManager() .addKeyEventDispatcher( e -> { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { frame.dispose(); return true; } return false; }); frame.setLayout(new BorderLayout()); frame.add(canvas, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); }
/** * This method starts the GUI. * * @throws CoapException Thrown, if the connection to obix via CoAP fails. */ public void runGui() throws CoapException { this.lobby = obixChannel.getLobby(obixChannel.getLobbyUri()); // Create and set up the window. mainFrame = new JFrame("ObixConnector at " + obixChannel.getBaseUri() + ": " + obixChannel.getPort()); mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); mainFrame.setUndecorated(false); mainFrame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { close(); } }); Container contentPane = mainFrame.getContentPane(); // Create and set up the content pane. this.addComponentToPane(contentPane); // Display the window. mainFrame.pack(); executor.execute(updateThread); connector.addRunAndStopAble(updateThread); mainFrame.setVisible(true); }
/** * Create the GUI and show it. For thread safety, this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { // Create and set up the window. JFrame frame = new JFrame("Automated File Mover"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent we) { try { FileOutputStream f_out = new FileOutputStream(LOG_DIRECTORY + "save.data"); // Write object with ObjectOutputStream ObjectOutputStream obj_out = new ObjectOutputStream(f_out); // Write object out to disk obj_out.writeObject(directoryList); obj_out.writeObject(ERROR_LOG_NAME); obj_out.writeObject(MOVE_LOG_NAME); obj_out.flush(); obj_out.close(); printer.printError(LOG_DIRECTORY); } catch (IOException x) { printer.printError(x.toString()); } } }); // Create and set up the content pane. JComponent newContentPane = new fileBackupProgram(frame); newContentPane.setOpaque(true); // content panes must be opaque frame.setContentPane(newContentPane); // Display the window. frame.pack(); frame.setVisible(true); }
private MainPanel(final JFrame frame) { super(); add(check); setPreferredSize(new Dimension(320, 240)); if (!SystemTray.isSupported()) { frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); return; } frame.addWindowListener( new WindowAdapter() { @Override public void windowIconified(WindowEvent e) { if (check.isSelected()) { e.getWindow().dispose(); } } }); // or // frame.addWindowStateListener(new WindowStateListener() { // @Override public void windowStateChanged(WindowEvent e) { // if (check.isSelected() && e.getNewState() == Frame.ICONIFIED) { // e.getWindow().dispose(); // } // } // }); final SystemTray tray = SystemTray.getSystemTray(); Dimension d = tray.getTrayIconSize(); BufferedImage image = makeBufferedImage(new StarIcon(), d.width, d.height); final PopupMenu popup = new PopupMenu(); final TrayIcon icon = new TrayIcon(image, "TRAY", popup); MenuItem item1 = new MenuItem("OPEN"); item1.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { frame.setVisible(true); } }); MenuItem item2 = new MenuItem("EXIT"); item2.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tray.remove(icon); frame.dispose(); // frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING)); } }); popup.add(item1); popup.add(item2); try { tray.add(icon); } catch (AWTException e) { e.printStackTrace(); } }
ChartGenerator createNewChart(final GUIState simulation) { generator = createNewGenerator(); globalAttributes = new GlobalAttributes(); generator.addGlobalAttribute(globalAttributes); // it'll be added last // set up the simulation -- need a new name other than guiObjects: and it should be // a HashMap rather than a Bag. if (simulation.guiObjects == null) simulation.guiObjects = new Bag(); simulation.guiObjects.add(generator); final JFrame f = generator.createFrame(simulation); WindowListener wl = new WindowListener() { public void windowActivated(WindowEvent e) {} public void windowClosed(WindowEvent e) {} public void windowClosing(WindowEvent e) { generator.quit(); } public void windowDeactivated(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowIconified(WindowEvent e) {} public void windowOpened(WindowEvent e) {} }; f.addWindowListener(wl); f.setVisible(true); return generator; }
private void registerDisposeListeners() { dialog.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { disposeFrame(); } }); // handle window closing commands for ctrl/cmd-W or hitting ESC. Toolkit.registerWindowCloseKeys( dialog.getRootPane(), new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { disposeFrame(); } }); dialog .getContentPane() .addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { // System.out.println(e); KeyStroke wc = Toolkit.WINDOW_CLOSE_KEYSTROKE; if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) || (KeyStroke.getKeyStrokeForEvent(e).equals(wc))) { disposeFrame(); } } }); }
public static void main(String[] args) { JFrame frame = new JFrame("options"); frame.setSize(new Dimension(500, 300)); frame.getContentPane().add(new PackagerOptionsPanel(null)); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { e.getWindow().dispose(); } @Override public void windowClosed(WindowEvent e) { System.exit(0); } }); try { SwingUtilities.invokeAndWait(new PackAndShowFrameWorker(frame)); } catch (InterruptedException e) { // Immediately reasserts the exception by interrupting the caller thread itself Thread.currentThread().interrupt(); e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }
/** The entry main() method */ public static void main(String[] args) { // Create the OpenGL rendering canvas GLCanvas canvas = new GLCanvas(); // heavy-weight GLCanvas canvas.setPreferredSize(new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT)); canvas.addGLEventListener(new JOGL2Nehe11Flag()); // Create a animator that drives canvas' display() at the specified FPS. final FPSAnimator animator = new FPSAnimator(canvas, FPS, true); // Create the top-level container frame final JFrame frame = new JFrame(); // Swing's JFrame or AWT's Frame frame.getContentPane().add(canvas); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { // Use a dedicate thread to run the stop() to ensure that the // animator stops before program exits. new Thread() { @Override public void run() { animator.stop(); // stop the animator loop System.exit(0); } }.start(); } }); frame.setTitle(TITLE); frame.pack(); frame.setVisible(true); animator.start(); // start the animation loop }
/** GUIコンポーネントを初期化する。 */ public void initComponent() { frame = new JFrame(ClientContext.getFrameTitle(title)); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { stop(); } }); JPanel contentPane = createBrowsePane(); contentPane.setBorder(BorderFactory.createEmptyBorder(12, 12, 11, 11)); contentPane.setOpaque(true); frame.setContentPane(contentPane); frame.pack(); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int n = ClientContext.isMac() ? 3 : 2; int x = (screen.width - frame.getPreferredSize().width) / 2; int y = (screen.height - frame.getPreferredSize().height) / n; frame.setLocation(x, y); blockGlass = new BlockGlass(); frame.setGlassPane(blockGlass); frame.setVisible(true); }
Main() { f = new JFrame("Wiki Seach"); JPanel p = new JPanel(); JPanel p1 = new JPanel(); b = new JButton("Search"); b1 = new JButton("Exit"); t = new JTextField(30); b.addActionListener(this); b1.addActionListener(this); p1.add(b); p1.add(b1); p.add(t); f.setLayout(new GridLayout(2, 1)); f.add(p); f.add(p1); f.pack(); f.setLocationRelativeTo(null); f.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); f.setVisible(true); }
// Main init private void init() { fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); fenetre.setBounds( LARG_ECRAN / 2 - LARG_FENETRE / 2, HAUT_ECRAN / 2 - HAUT_FENETRE / 2, LARG_FENETRE, HAUT_FENETRE); fenetre.setResizable(false); fenetre.setLayout(null); // ajout d'un ecouteur a la fenetre fenetre.addWindowListener(this); initPanneauHaut(); initPanneauMillieu(); initPanneauBas(); initLabels(); initPanneauHautComponents(); initPanneauMillieuComponents(); initPanneauBasComponents(); ajouterAFenetre(); modeConsultation(); ajouterActionListener(); // derniere instruction fenetre.setVisible(true); }
public void go() { picture(); ActionListener listener = new BtListener(); go.addActionListener(listener); btn_update_manual.addActionListener(listener); go.setForeground(Color.black); // rights.setFont((new Font("Arial", Font.PLAIN, 12))); title.setFont((new Font("Arial", Font.BOLD, 36))); title.setForeground(new Color(238, 253, 253)); today.setFont((new Font("Arial", Font.BOLD, 16))); today.setForeground(new Color(163, 184, 204)); frame.setLayout(new BorderLayout()); from.setBackground(Color.white); to.setBackground(Color.white); converted.setFont(new Font("Arial", Font.BOLD, 24)); converted.setForeground(new Color(238, 253, 253)); Lfrom.setForeground(new Color(238, 253, 253)); Lto.setForeground(new Color(238, 253, 253)); quantity.setForeground(new Color(238, 253, 253)); Lfrom.setFont(new Font("Arial", Font.BOLD, 24)); Lto.setFont(new Font("Arial", Font.BOLD, 24)); quantity.setFont(new Font("Arial", Font.BOLD, 24)); north.setLayout(new FlowLayout()); north.add(title); north.setBackground(new Color(59, 62, 71)); frame.add(BorderLayout.NORTH, north); inner.setLayout(new BorderLayout()); inner.add(BorderLayout.NORTH, today); inner.add(BorderLayout.WEST, picPanel); center.setLayout(new GridLayout(2, 4, 5, 5)); center.add(Lfrom); center.add(from); center.add(Lto); center.add(to); center.add(quantity); center.add(amount); center.add(go); inner.setBackground(new Color(59, 62, 71)); inner.add(BorderLayout.SOUTH, center); center.setBackground(new Color(59, 62, 71)); frame.add(BorderLayout.CENTER, inner); south.setBackground(new Color(59, 62, 71)); south.setLayout(new FlowLayout()); south.add(converted); south.add(answer); south.add(btn_update_manual); // south.add(rights); frame.add(BorderLayout.SOUTH, south); frame.setSize(850, 700); frame.setVisible(true); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent event) { frame.setVisible(false); frame.dispose(); System.exit(0); } }); }
/** Simple test program. */ public static void main(String[] args) { final JFrame frame = new JFrame("Testing AddPersonDialog"); JButton button = new JButton("Click me"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { FamilyTree tree = new FamilyTree(); AddPersonDialog dialog = new AddPersonDialog(frame, tree); dialog.pack(); dialog.setLocationRelativeTo(frame); dialog.setVisible(true); Person newPerson = dialog.getPerson(); if (newPerson != null) { tree.addPerson(newPerson); PrettyPrinter pretty = new PrettyPrinter(new PrintWriter(System.out, true)); pretty.dump(tree); } } }); frame.getContentPane().add(button); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(1); } }); frame.pack(); frame.setVisible(true); }
void makeFrame() { JPanel p = new JPanel(); p.setBackground(Color.blue); p.setLayout(new BorderLayout(0, 0)); p.setBorder(new EmptyBorder(0, GAP, GAP, GAP)); days.setFont(BIG); days.setForeground(COLOR); p.add(days, "North"); left.setFont(NORM); left.setForeground(COLOR); p.add(left, "South"); JFrame f = new JFrame("Sayaç"); // a window f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setContentPane(p); setDate(); f.pack(); // minimal size f.setVisible(true); // show f.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { stop(); } }); }
public void go() throws IOException { // DefaultRouteTable route = new DefaultRouteTable(); // System.out.println(route.routeInfo()); // route.routeInfo(); totalSize = Toolkit.getDefaultToolkit().getScreenSize(); // getting screen size int width = totalSize.width; int height = totalSize.height; frame = new JFrame(); // creating frame frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent we) { FileInput data = null; try { data = new FileInput("input.txt"); } catch (Exception e) { } String[][] origRoutes = convertArrayListTo2DArray(data.routeArrayList(data.routesToken), 1); String[][] routesList = Main.convertArrayListTo2DArray(routesInfo, 1); Main.changesCheck(origRoutes, routesList); } }); frame.setTitle("Air Route Planner"); frame.add(Panels()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize((width * 3 / 4), (height * 3 / 4)); frame.setJMenuBar(menuBar()); frame.setResizable(false); frame.setVisible(true); frame.setLocationRelativeTo(null); }
/** EdiDialog constructor comment. */ public static void test() { JFrame frame = new JFrame(); frame.addWindowListener(new CloseSaveWindowsListener()); frame.setBackground(ConfigurableSystemSettings.backgroundColor.getAWTColor()); frame.getContentPane().setLayout(new java.awt.BorderLayout()); frame.setBounds(50, 50, 400, 400); frame.show(); DialogNewElement dialog = new DialogNewElement(frame); dialog.show(); }
public static void main(String args[]) { JFrame f = new JFrame("JPasswordField3"); Container contentPane = f.getContentPane(); contentPane.setLayout(new BorderLayout()); JPanel p1 = new JPanel(); // p1.setLayout(new GridLayout(4,2)); p1.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; // 设定Layout的位置 gbc.insets = new Insets(2, 2, 2, 2); // 设定与边界的距离(上,左,下,右) p1.setBorder(BorderFactory.createTitledBorder("您的基本数据")); JLabel l1 = new JLabel("姓名:"); JLabel l2 = new JLabel("性别:"); JLabel l3 = new JLabel("身高:"); JLabel l4 = new JLabel("体重:"); JPasswordField t1 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(10), "", 10); JPasswordField t2 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(1), "", 2); JPasswordField t3 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(5), "", 5); JPasswordField t4 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(5), "", 5); gbc.gridy = 1; gbc.gridx = 0; p1.add(l1, gbc); gbc.gridx = 1; p1.add(t1, gbc); gbc.gridy = 2; gbc.gridx = 0; p1.add(l2, gbc); gbc.gridx = 1; p1.add(t2, gbc); gbc.gridy = 3; gbc.gridx = 0; p1.add(l3, gbc); gbc.gridx = 1; p1.add(t3, gbc); gbc.gridy = 4; gbc.gridx = 0; p1.add(l4, gbc); gbc.gridx = 1; p1.add(t4, gbc); contentPane.add(p1); f.pack(); f.show(); f.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); }
/** * A simplified way to see a JPanel or other Container. Pops up a JFrame with specified Container * as the content pane. */ public static JFrame openInJFrame( Container content, int width, int height, String title, Color bgColor) { JFrame frame = new JFrame(title); frame.setBackground(bgColor); content.setBackground(bgColor); frame.setSize(width, height); frame.setContentPane(content); frame.addWindowListener(new ExitListener()); frame.setVisible(true); return (frame); }
public static void main(String[] args) { JFrame f = new JFrame("Model"); InitGraphics(f); // Exit application when the window is closed f.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); }
private void mostrarGUI() { janela = new JFrame("Exemplo Swing - JFrame"); janela.setSize(400, 400); janela.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent windowEvent) { System.exit(0); } }); janela.setVisible(true); }
public LoginScreen(DBConnectionFactory factory) { this.factory = factory; loginFrame = new JFrame("Login"); loginFrame.setSize(500, 450); loginFrame.setVisible(true); Container content = loginFrame.getContentPane(); JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints cs = new GridBagConstraints(); cs.fill = GridBagConstraints.HORIZONTAL; lbUsername = new JLabel("Username: "******"Password: "******"Login"); loginButton.addActionListener(this); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); JPanel buttonPanel = new JPanel(); buttonPanel.add(loginButton); buttonPanel.add(cancelButton); content.add(panel, BorderLayout.CENTER); content.add(buttonPanel, BorderLayout.SOUTH); loginFrame.addWindowListener(new ExitListener()); }
private static void createFrame() { frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { app.stop(); } }); createTabs(); createMenu(); }
/** Create the entire GUI from scratch */ private void createGUI() { clientFrame = new JFrame("LeetFTP"); // Allow program to exit gracefully clientFrame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); createTabs(); createMenu(); // Top Options Bar connectButton = new JButton("Connect"); connectButton.addMouseListener(mouseHandler); optionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); optionPanel.add(connectButton); optionPanel.add(new JLabel("Name Server Hostname")); optionPanel.add(serverTextField); optionPanel.add(new JLabel("Port #")); optionPanel.add(portTextField); optionPanel.add(new JLabel("UserName")); optionPanel.add(nameTextField); // Bottom Transfer Table transferTable = new JTable(); transferPanel = new JPanel(new BorderLayout()); transferPanel.add(new JLabel("Current Transfers:"), BorderLayout.NORTH); transferPanel.add(transferTable); // Make the tab pane the GUI pane clientFrame.getContentPane().setLayout(new BorderLayout()); clientFrame.getContentPane().add(mainPanel); clientFrame.getContentPane().add(optionPanel, BorderLayout.NORTH); clientFrame.getContentPane().add(transferPanel, BorderLayout.SOUTH); // Set Client Window Properties clientFrame.setSize(800, 600); // clientFrame.setResizable(false); clientFrame.setLocationRelativeTo(null); clientFrame.setVisible(true); }
// type 'java Parallel' to run this application public static void main(String args[]) throws VisADException, RemoteException, IOException { RealType index = RealType.getRealType("index"); RealType[] coords = new RealType[NCOORDS]; for (int i = 0; i < NCOORDS; i++) { coords[i] = RealType.getRealType("coord" + i); } RealTupleType range = new RealTupleType(coords); FunctionType ftype = new FunctionType(index, range); Integer1DSet index_set = new Integer1DSet(NROWS); float[][] samples = new float[NCOORDS][NROWS]; for (int i = 0; i < NCOORDS; i++) { for (int j = 0; j < NROWS; j++) { samples[i][j] = (float) Math.random(); } } FlatField data = new FlatField(ftype, index_set); data.setSamples(samples, false); // create a 2-D Display using Java3D DisplayImpl display = new DisplayImplJ3D("display", new TwoDDisplayRendererJ3D()); parallel(display, data); // create JFrame (i.e., a window) for display and slider JFrame frame = new JFrame("Parallel Coordinates VisAD Application"); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); // create JPanel in JFrame JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setAlignmentY(JPanel.TOP_ALIGNMENT); panel.setAlignmentX(JPanel.LEFT_ALIGNMENT); frame.getContentPane().add(panel); // add display to JPanel panel.add(display.getComponent()); // set size of JFrame and make it visible frame.setSize(500, 500); frame.setVisible(true); }
public static void main(String[] args) { BasicConfigurator.configure(); initializeLookAndFeels(); final JFrame frame = new JpasFrame(); frame.addWindowListener( new WindowAdapter() { public void windowClosing(final WindowEvent we) { System.exit(0); } }); frame.setVisible(true); }
public static void main(String[] args) { JFrame ventana = new JFrame("Open"); ventana.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); ventana.getContentPane().add(new marcador(), BorderLayout.CENTER); ventana.setSize(300, 100); ventana.setVisible(true); }
public static void main(String[] args) { TestTtsp ttsp = new TestTtsp(); JFrame jframe = new JFrame("TTSP - Time Precision Error"); ttsp.setPrecisionErrorChart(new PrecisionErrorChart()); jframe.getContentPane().add(ttsp.getPrecisionErrorChart(), "Center"); jframe.setBounds(200, 120, 600, 280); jframe.setVisible(true); jframe.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent windowevent) { System.exit(0); } }); JFrame jframe2 = new JFrame("TTSP - Synchronization Period"); ttsp.setSyncPeriodChart(new SyncPeriodChart()); jframe2.getContentPane().add(ttsp.getSyncPeriodChart(), "Center"); jframe2.setBounds(200, 120, 600, 280); jframe2.setVisible(true); jframe2.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent windowevent) { System.exit(0); } }); try { Thread.sleep(10000); } catch (InterruptedException e) { // TODO Auto-generated catch block // e.printStackTrace(); } }
public void launchFrame() { JFrame frame = new JFrame("Mensajero"); frame.setLayout(new BorderLayout()); frame.add(Salida, BorderLayout.CENTER); frame.add(Entrada, BorderLayout.SOUTH); JPanel p1 = new JPanel(); p1.setLayout(new GridLayout(2, 1)); p1.add(Enviar); p1.add(Salir); frame.addWindowListener(new CerrarHandler()); frame.add(p1, BorderLayout.EAST); frame.pack(); frame.setVisible(true); }
/** Creates the JFrame that will contain everything. */ protected JFrame createFrame() { JFrame retFrame = new JFrame("TreeTable III -- " + path); Dimension dimension = new Dimension(600, 400); retFrame.setSize(600, 600); retFrame.setMinimumSize(dimension); retFrame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent we) { frame.dispose(); if (--ttCount == 0) { System.exit(0); } } }); return retFrame; }