// --------------------------------actionConnect------------------------------ private void actionConnect() { if (oParty == null) { JOptionPane.showMessageDialog(frame, "Make a party before trying to connect."); return; } String[] oResults = (String[]) DialogManager.show(DialogManager.CONNECT, frame); if (oResults[DialogManager.RETURN_IP].equals("cancel")) return; lblStatus3.setText("Connecting..."); try { oConn.connect( oResults[DialogManager.RETURN_IP], Integer.parseInt(oResults[DialogManager.RETURN_PORT])); } catch (UnknownHostException e) { JOptionPane.showMessageDialog( frame, "The IP of the host cannot be determined.", "Unknown Host Exception", JOptionPane.ERROR_MESSAGE); frame.repaint(); return; } catch (IOException e) { JOptionPane.showMessageDialog( frame, e.getMessage(), "Input/Output Exception", JOptionPane.ERROR_MESSAGE); frame.repaint(); return; } echo("Connected to opponent!"); tConn = new Thread(oConn, "conn"); tConn.start(); tMain = new Thread(this, "main"); tMain.start(); }
/** * Sets each column to the column to the right, staring from the left most column * * @param comp The matrix to be 'shifted' * @param passFrame Used for repainting the frame */ public static void shiftMatrix(Matrix[][] comp, JFrame passFrame) { for (int y = 0; y < 4; y++) { for (int x = 0; x < 5; x++) { passFrame.repaint(); comp[x][y].setLedStatus(comp[x][y + 1].getLedStatus()); passFrame.repaint(); } passFrame.repaint(); } passFrame.repaint(); pauseMatrix(250); passFrame.repaint(); }
public void actionPerformed(ActionEvent e) { if (e.getSource() == b_salir) { JOptionPane.showMessageDialog( this, "Ya no estas logueado", "Fin de sesion", JOptionPane.INFORMATION_MESSAGE); actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel); actual.getContentPane().remove(0); actual.getContentPane().add(new PantallaInicio(this.rmi)); actual.setPreferredSize(new Dimension(629, 359)); actual.pack(); actual.repaint(); actual.setLocationRelativeTo(null); } else if (e.getSource() == b_Baja) { try { ControllerTES.getInstance(rmi).darseBaja(this.nomUsuario); JOptionPane.showMessageDialog( this, "Te acabas de dar de baja de THE ELDER SCROLLS CHARACTER CREATOR", "Baja usuario", JOptionPane.INFORMATION_MESSAGE); actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel); actual.getContentPane().remove(0); actual.getContentPane().add(new PantallaInicio(this.rmi)); actual.setPreferredSize(new Dimension(629, 359)); actual.pack(); actual.repaint(); actual.setLocationRelativeTo(null); } catch (RemoteException e1) { JOptionPane.showMessageDialog( this, "No te has podido dar de baja de THE ELDER SCROLLS CHARACTER CREATOR", "Error baja usuario", JOptionPane.ERROR_MESSAGE); e1.printStackTrace(); } } else if (e.getSource() == b_cargarPersonaje) { actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel); actual.getContentPane().remove(0); actual.getContentPane().add(new PantallaTablaPersonaje(nomUsuario, this.rmi)); actual.setPreferredSize(new Dimension(629, 359)); actual.pack(); actual.repaint(); actual.setLocationRelativeTo(null); } else if (e.getSource() == b_nuevoPersonaje) { actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel); actual.dispose(); MenuPersonaje mp = new MenuPersonaje("PantallaLogin", this.nomUsuario, "", this.rmi); } }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == btnlocalizar) { if (txtcod.getText().equals("")) { JOptionPane.showMessageDialog(null, "Campos Vazios!"); } else { ArrayList<String> listar = new ArrayList<String>(); listar = produto.especifico(Integer.parseInt(txtcod.getText())); if (listar.isEmpty()) { JOptionPane.showMessageDialog(null, "Não encontrado"); } else { txtnome.setText(listar.get(1)); txtvalor.setText(listar.get(2)); btnSalvar.setVisible(false); btnalterar.setVisible(true); btnlocalizar.setVisible(false); btnexcluir.setVisible(true); } } } else if (e.getSource() == btnSalvar) { produto.salvar(txtnome.getText(), Double.parseDouble(txtvalor.getText())); } if (e.getSource().equals(btnexcluir)) { produto.excluir(Integer.parseInt(txtcod.getText())); btnSalvar.setVisible(true); btnalterar.setVisible(false); btnlocalizar.setVisible(true); btnexcluir.setVisible(false); txtnome.setText(""); txtvalor.setText(""); tela.repaint(); } if (e.getSource().equals(btnalterar)) { produto.alterar( Integer.parseInt(txtcod.getText()), txtnome.getText(), Double.parseDouble(txtvalor.getText())); btnSalvar.setVisible(true); btnalterar.setVisible(false); btnlocalizar.setVisible(true); btnexcluir.setVisible(false); txtnome.setText(""); txtvalor.setText(""); tela.repaint(); } }
private void showPanel(JPanel p) { setUpUnitLists(); mainPanel.removeAll(); mainPanel.add(p); mainFrame.repaint(); mainFrame.revalidate(); }
@Override public void showMenuCaja(CajaController cc, JFrame f, Usuario u) { usuario = u; System.out.println("SHOW CAJA"); cajaController = cc; frame = f; PanelGeneral panelGeneral = new PanelGeneral(u); listenerCajaVolver = new ListenerCajaVolver(cc); listenerVerMovimientos = new ListenerVerMovimientos(cc); listenerVerOtrosMovimientos = new ListenerVerOtrosMovimientos(cc); panelCajaMenu.getBtnVolver().addActionListener(listenerCajaVolver); panelCajaMenu.getBtnVerMovs().addActionListener(listenerVerMovimientos); panelCajaMenu.getBtnVerUnDia().addActionListener(listenerVerOtrosMovimientos); frame.setTitle("Menu Caja"); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.getContentPane().removeAll(); frame.getContentPane().add(panelGeneral, BorderLayout.PAGE_START); frame.getContentPane().add(panelCajaMenu, BorderLayout.WEST); frame.getContentPane().add(panelCaja, BorderLayout.LINE_END); frame.validate(); frame.repaint(); }
/** Display the picture in a window on the screen. */ public void show() { // create the GUI for viewing the image if needed if (frame == null) { frame = new JFrame(); JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("File"); menuBar.add(menu); JMenuItem menuItem1 = new JMenuItem(" Save... "); menuItem1.addActionListener(this); menuItem1.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); menu.add(menuItem1); frame.setJMenuBar(menuBar); frame.setContentPane(getJLabel()); // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setTitle(filename); frame.setResizable(false); frame.pack(); frame.setVisible(true); } // draw frame.repaint(); }
public static void main(final String[] args) throws Exception { final JFrame frame = new DrawBitmaskToSurfaceTest(); frame.setBounds(10, 350, 200, 200); frame.setVisible(true); Thread.sleep(2000); System.err.println("Change frame bounds..."); latch = new CountDownLatch(1); frame.setBounds(10, 350, 90, 90); frame.repaint(); try { if (latch.getCount() > 0) { latch.await(); } } catch (InterruptedException e) { } frame.dispose(); if (theError != null) { throw new RuntimeException("Test failed.", theError); } System.err.println("Test passed"); }
private void start() { frame = new JFrame("Pong"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); panel = new JPanel() { public Dimension getPreferredSize() { return new Dimension(W, H); } public void paint(Graphics g) { for (Brick b : bricks) { b.paint(g); } ball.paint(g); paddle.paint(g); } }; frame.setContentPane(panel); frame.pack(); frame.setVisible(true); while (true) { try { tick(); frame.repaint(); Thread.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); } } }
public void actionPerformed(ActionEvent e) { JFrame mainFrame = MainFrame.getMain(); mainFrame.setContentPane(new EmployeeHomePanel(employee)); mainFrame.setBounds(mainFrame.getContentPane().getBounds()); mainFrame.setVisible(true); mainFrame.repaint(); }
public void actionPerformed(ActionEvent evento) { Paciente nuevo = null; if (evento.getActionCommand().equals("Añadir")) { AñadePacienteFrame paciente = new AñadePacienteFrame(ventana, nuevo); nuevo = paciente.getPaciente(); if (nuevo != null) modelo.addElement(nuevo); } if (evento.getActionCommand().equals("Eliminar")) { int indice = pacientes.getSelectedIndex(); if (indice != FALLO) { int reply = JOptionPane.showConfirmDialog( null, "¿Estas seguro de eliminar al paciente?", "", JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.YES_OPTION) modelo.remove(indice); } } if (evento.getActionCommand().equals("Modificar")) { int indice = pacientes.getSelectedIndex(); if (indice != FALLO) { AñadePacienteFrame paciente = new AñadePacienteFrame(ventana, modelo.getElementAt(indice)); if (cambios(paciente.getPaciente(), modelo.getElementAt(indice))) { modelo.getElementAt(indice).setPaciente(paciente.getPaciente()); ventana.repaint(); } } } }
public static void main(String[] args) { try { // myFrame.add(newSubPanel); JTabbedPane tabbedPane = new JTabbedPane(); isSmall = true; // tabbedPane.add(new JButton("asd")); JMenuBar menuBar = new JMenuBar(); // menuBar.add(tabbedPane); menuBar.setBackground(Color.white); menuBar.setVisible(true); menuBar.add(new ResolutionButton()); menuBar.add(new NextPanelbutton(false)); menuBar.add(new NextPanelbutton(true)); // menuBar.setPreferredSize(new Dimension(1024, 20)); UpploaderView u = new UpploaderView(); tabbedPane.addTab("Channel", u); tabbedPane.addTab("Videos", newSubPanel); // menuBar.add(tabbedPane); // tabbedPane.setTabComponentAt(0,menuBar); // myFrame.add(u); // myFrame.add(tabbedPane); // myFrame.setLayout(new FlowLayout()); // Toolkit toolkit = Toolkit.getDefaultToolkit(); // System.out.println(toolkit.getScreenSize().width+"x"+toolkit.getScreenSize().height); myFrame.setSize(1024, 600); myFrame.setJMenuBar(menuBar); myFrame.addWindowListener(new WindowClose()); myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); myFrame.setVisible(true); Dimension panelDim = myFrame.getRootPane().getSize(); // myFrame.add(newSubPanel); for (int i = 0; i < 3; i++) { if (i == 0) { newSubs = new DoublePanelStack(new NewSubVideoPanel(panelDim)); myFrame.add(newSubs.getCurrentPanel()); myFrame.validate(); myFrame.repaint(); } if (StatCol.newsubsStartIndex < StatCol.MAXNEWSUBVIDEOS) newSubs.add(new NewSubVideoPanel(panelDim)); } // u.init(); // sub2 = new NewSubVideoPanel(newSubPanel.init(),panelDim); myFrame.validate(); // myFrame.pack(); } catch (AuthenticationException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (ServiceException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
public void repaint() { String message = getWorld().getMessage(); if (message == null) message = resources.getString("message.default"); messageArea.setText(message); messageArea.repaint(); display.repaint(); // for applet super.repaint(); }
public static void prevPanel() { if (currentStack.hasPrev()) { myFrame.remove(currentStack.getCurrentPanel()); myFrame.add(currentStack.getPrev()); currentStack.getCurrentPanel().setVisible(true); myFrame.validate(); myFrame.repaint(); } }
public void repaint() { if (frame == null) return; Dimension dim = component.getPreferredSize(); if (dim.getWidth() > component.getWidth() || dim.getHeight() > component.getHeight()) { frame.pack(); } else { frame.repaint(); } }
@Override public void mouseReleased(MouseEvent e) { isLeftButtonPressed = false; if (e.getButton() == MouseEvent.BUTTON3) { ((DrawPad) parent).getSelectedLayer().undoLastDraw(); } else if ((e.getButton() == MouseEvent.BUTTON1) && ((DrawPad) parent).isRubberMode()) { ((DrawPad) parent).getSelectedLayer().eraseEnd(); } parent.repaint(); }
public void run() { switch (Connection.connectionStatus) { case DISCONNECTED: connectButton.setEnabled(true); disconnectButton.setEnabled(false); clearButton.setEnabled(true); ipField.setEnabled(true); portField.setEnabled(true); windowWidth.setEnabled(true); statusColor.setBackground(Color.red); break; case DISCONNECTING: connectButton.setEnabled(false); disconnectButton.setEnabled(false); clearButton.setEnabled(false); ipField.setEnabled(false); portField.setEnabled(false); windowWidth.setEnabled(false); statusColor.setBackground(Color.orange); break; case CONNECTED: connectButton.setEnabled(false); disconnectButton.setEnabled(true); clearButton.setEnabled(true); ipField.setEnabled(false); portField.setEnabled(false); windowWidth.setEnabled(false); statusColor.setBackground(Color.green); break; case BEGIN_CONNECT: connectButton.setEnabled(false); disconnectButton.setEnabled(false); clearButton.setEnabled(false); ipField.setEnabled(false); portField.setEnabled(false); windowWidth.setEnabled(false); statusColor.setBackground(Color.orange); break; default: break; } ipField.setText(Connection.hostIP); portField.setText((new Integer(Connection.port)).toString()); statusField.setText(Connection.statusString); chatText.append(Connection.toAppend.toString()); windowWidth.setText(TCPServer.windowWidth.toString()); Connection.toAppend.setLength(0); mainFrame.repaint(); }
/** * Will save the currently selected image as the image of the class if OK is pressed. * * <p>If performed on the current world this will allow for previewing of the currently selected * image, but revert to the original background image of cancelled. * * @param e ignored */ public void actionPerformed(ActionEvent e) { final World currentWorld = WorldHandler.getInstance().getWorld(); // save the original background if possible final GreenfootImage originalBackground = ((currentWorld == null) ? null : WorldVisitor.getBackgroundImage(currentWorld)); // allow the previewing if we are setting the image of the current world. ImageSelectionWatcher watcher = null; if (currentWorld != null && currentWorld.getClass().getName().equals(classView.getGClass().getQualifiedName())) { watcher = new ImageSelectionWatcher() { @Override public void imageSelected(final File imageFile) { if (imageFile != null) { Simulation.getInstance() .runLater( new Runnable() { @Override public void run() { if (WorldHandler.getInstance().getWorld() == currentWorld) { currentWorld.setBackground(imageFile.getAbsolutePath()); } } }); } } }; } // initialise our image library frame JFrame gfFrame = GreenfootMain.getInstance().getFrame(); ImageLibFrame imageLibFrame = new ImageLibFrame(gfFrame, classView, watcher); DialogManager.centreDialog(imageLibFrame); imageLibFrame.setVisible(true); // set the image of the class to the selected file if (imageLibFrame.getResult() == ImageLibFrame.OK) { File currentImageFile = imageLibFrame.getSelectedImageFile(); setClassImage(classView, gclassRole, currentImageFile); gfFrame.repaint(); } // or if cancelled reset the world background to the original format // to avoid white screens or preview images being left there. else if (currentWorld != null && imageLibFrame.getResult() == ImageLibFrame.CANCEL) { Simulation.getInstance() .runLater( new Runnable() { @Override public void run() { currentWorld.setBackground(originalBackground); } }); } }
public void actionPerformed(ActionEvent event) { Thread.currentThread().setContextClassLoader(cl); final JFrame frame = new JFrame("REPL connect"); final Container cp = frame.getContentPane(); final JLabel initLabel = new JLabel("Initializing Clojure"); cp.add(initLabel); frame.setSize(200, 100); frame.setVisible(true); frame.validate(); frame.repaint(); final Runnable after = new Runnable() { public void run() { Thread.currentThread().setContextClassLoader(cl); Var newDialog = RT.var("protege.dialog", "new-dialog-panel"); cp.removeAll(); JPanel dialog = (JPanel) newDialog.invoke(getOWLEditorKit()); cp.add(dialog); frame.pack(); frame.setVisible(true); frame.validate(); frame.repaint(); } }; final Runnable before = new Runnable() { public void run() { Thread.currentThread().setContextClassLoader(cl); try { if (!clojureInit) { synchronized (lock) { RT.loadResourceScript("protege/dialog.clj"); RT.loadResourceScript("protege/nrepl.clj"); initLabel.setText("Reading User Init"); Var init = RT.var("protege.nrepl", "init"); init.invoke(); clojureInit = true; } } SwingUtilities.invokeAndWait(after); } catch (Exception exp) { throw new RuntimeException(exp); } } }; new Thread(before).start(); }
private void setLayout() { GroupLayout layout = new GroupLayout(dialog.getContentPane()); dialog.getContentPane().setLayout(layout); dialog.setResizable(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createParallelGroup().addComponent(tabbedPane)); layout.setVerticalGroup(layout.createParallelGroup().addComponent(tabbedPane)); layout.setHonorsVisibility(tabbedPane, true); // TODO set color here dialog.getContentPane().setBackground(new Color(0x132638)); dialog.validate(); dialog.repaint(); }
/** * Responsible for creating a {@link GemIdentView.ScrollablePicture ScrollablePicture} object for * a given result matrix. If there's not enough RAM it will display exactly how much RAM is needed * for the operation. * * @param name the name of the result matrix * @param time the time when the "display" function was invoked by the user * @param I the result matrix as a buffered image * @param dir the directory where the image is located (if saved somewhere, otherwise null) * @param displayImageOnScreen should we pop a JFrame and show it on the screen? * @return the {@link GemIdentView.ScrollablePicture ScrollablePicture} object embodying B */ public static ScrollablePicture GenerateScrollablePicElement( String name, Long time, BufferedImage I, String dir, ConsoleParser consoleParser, boolean displayImageOnScreen) { ScrollablePicture pic = null; try { pic = new ScrollablePicture(new ImageIcon(I), 10); } catch (Throwable t) { long mem = (long) I.getWidth() * (long) I.getHeight(); double gigs = mem / Math.pow(10, 9); NumberFormat format = NumberFormat.getInstance(); format.setMaximumFractionDigits(2); if (consoleParser != null) { if (gigs > 1) consoleParser.WriteToScreen( "out of memory - need " + format.format(gigs) + "G", null, Console.error); else { double megs = mem / Math.pow(10, 6); consoleParser.WriteToScreen( "out of memory - need " + format.format(megs) + "M", null, Console.error); } } } // display image on screen? if (displayImageOnScreen && name != null) { JScrollPane view = new JScrollPane(pic); view.repaint(); JFrame frame = new JFrame(); frame.setSize(KFrame.frameSize); frame.add(view); frame.setTitle("image \"" + name + "\""); frame.setVisible(true); frame.setResizable(true); frame.repaint(); frame.requestFocus(); } // did you supply a console parser and a timestamp to display a confirmation? if (consoleParser != null && time != null) { consoleParser.WriteToScreen( "Display completed in " + Run.TimeElapsed(time), null, Console.time); } // did you supply a directory where the image was saved to? if (dir != null && consoleParser != null) consoleParser.WriteToScreen("Image located at: " + dir, null, Console.neutral); return pic; }
public static void main(String[] arg) { JFrame vindue = new JFrame("TegnbareObjekter 3"); vindue.add(new TegnbareObjekter_3()); vindue.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); vindue.setSize(300, 300); vindue.setVisible(true); while (true) { try { Thread.sleep(3000); } catch (Exception e) { } // vent 3 sek. vindue.repaint(); // gentegn skærm } }
@Override public void mousePressed(MouseEvent e) { DrawPad drawPad = (DrawPad) parent; if (drawPad.getSelectedLayer().isHidden()) { return; } if (e.getButton() == MouseEvent.BUTTON1) { isLeftButtonPressed = true; drawPad.getSelectedLayer().startToDraw(e.getPoint()); parent.repaint(); } else { isLeftButtonPressed = false; } }
public void actionPerformed( ActionEvent e) { // action event for when either the button or the enter key is pressed nameInput = summonerTextField.getText().toLowerCase().replaceAll(" ", ""); // change text format for URL if (nameInput.equals("")) { errorLabel.setText("You need to type something!"); } else { errorLabel.setText("Loading..."); String comboBoxValue = getComboBoxValue(regionsComboBox).toString(); // get combobox string ConvertToCountryCode(comboBoxValue); // convert it to country code ex. na, eu, ru, etc. getMostRecentVersion(regionCodeValue); System.out.println("Loading next page..."); // System.out.println("The button was pressed.\nnameInput text: " + nameInput + "\nRegion // code: " + regionCodeValue+"\nVersion: " + version); /*This is where the next page will be called. JSON information must be retrieved from another class.*/ // class objects Summoner_ByName objSummByName = new Summoner_ByName( nameInput, regionCodeValue, version); // get Summoner_ByName information from endpoint if (objSummByName.getDoesExist()) { // if the searched summoner exists // prepare frame for next page masterFrame.getContentPane().removeAll(); masterFrame.revalidate(); masterFrame.repaint(); Game_ById GAME_BY_ID = new Game_ById( objSummByName.getSummonerId(), regionCodeValue, version); // get Game_ById information from endpoint LoLStaticData_AllChampions DATA_ALL_CHAMPIONS = new LoLStaticData_AllChampions( GAME_BY_ID.getChampionIdList(), regionCodeValue, version); // get data for all champions from endpoint League_ById LEAGUE_BY_ID = new League_ById(regionCodeValue, objSummByName.getSummonerId()); MatchHistoryPage MATCH_HISTORY_PAGE = new MatchHistoryPage( regionCodeValue, masterFrame, objSummByName, GAME_BY_ID, DATA_ALL_CHAMPIONS, LEAGUE_BY_ID); // proceed to match history page frameTimer.cancel(); // stop frame timer from going forever } else { errorLabel.setText("Player does not exist. Please try again."); } } }
// handles the JFrame and Main Content public Controls() { tabs.add("Frame Grabber", window); tabs.add("Script Editor", script); tabs.add("Audio Recording", audioStudio); f.add(tabs); System.setProperty("sun.java2d.opengl", "True"); f.setJMenuBar(toolbar.toolBar); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (RuntimeException e) { throw e; } catch (Exception e) { e.printStackTrace(); } f.setTitle("Pre-Alpha-003-A"); f.setSize( Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height); f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); f.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { camera.endLiveView(); camera.closeSession(); CanonCamera.close(); try { Frame.grabber.stop(); } catch (FrameGrabber.Exception ex) { Logger.getLogger(Controls.class.getName()).log(Level.SEVERE, null, ex); } System.exit(0); } }); f.setLocationRelativeTo(null); f.setResizable(true); f.setVisible(true); window.setLayout(null); // Method init error_Check(); audioEditor(); timeLine(); drawButtons(); scriptEditor(); f.repaint(); }
@Override public void mouseDragged(MouseEvent e) { DrawPad drawPad = (DrawPad) parent; if (drawPad.getSelectedLayer().isHidden()) { return; } if (isLeftButtonPressed) { if (drawPad.isRubberMode()) { drawPad.getSelectedLayer().erase(e.getPoint()); } else { drawPad.getSelectedLayer().drawLine(e.getPoint()); } parent.repaint(); } }
public FisioFrame(JFrame principal) { ventana = new JFrame("Panel del Fisioterapeuta"); bAñadir = new JButton("Añadir"); bEliminar = new JButton("Eliminar"); bModificar = new JButton("Modificar"); lEjercicio = new JLabel(); ventana.setSize(ANCHOPANTALLA, LARGOPANTALLA); ventana.setResizable(true); ventana.setLocation(POSPANTALLAX, POSPANTALLAY); ventana.setContentPane(crearPanelVentana()); meteListeners(); ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ventana.setVisible(true); ventana.repaint(); }
public static void main(String[] args) { JFrame frame = new JFrame("Network Tables"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); Display display = new Display(); frame.getContentPane().add(display); frame.setLocation(0, 0); frame.setSize(new Dimension(2000, 700)); frame.revalidate(); frame.repaint(); frame.setVisible(true); }
private void createAndShowGUI(String sendToRight) { if (screen == null) { screen = new JFrame(); screen.setLayout(new GridLayout(0, 2)); screen.setTitle("Spiral Numbers"); screen.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); screen.add(this.makeLeftSide()); } else { screen.remove(right); } this.setRightSide(sendToRight); screen.add(right); // Display the window. screen.pack(); screen.setVisible(true); screen.repaint(); }
private void refreshTable() { try { if (scrollPane.isAncestorOf(table)) { frame.remove(scrollPane); scrollPane.remove(table); frame.validate(); frame.repaint(); } } catch (NullPointerException e) { } DefaultTableModel dm = new DefaultTableModel(); dm.setDataVector(getValuesArray(), new Object[] {"Name", ""}); table = new JTable(dm); table.getColumn("").setMaxWidth(120); table.getColumn("").setCellRenderer(new ButtonRenderer()); table.getColumn("").setCellEditor(new ButtonEditor(new JCheckBox())); table .getModel() .addTableModelListener( new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { int row = e.getFirstRow(); int column = e.getColumn(); TableModel model = (TableModel) e.getSource(); String columnName = model.getColumnName(column); String newValue = model.getValueAt(row, column).toString(); eaArrayList_RenamededFolders.add( new EA_Rename(EA_Utils.getColumnsArrayList().get(row), newValue, row)); } }); scrollPane = new JScrollPane(table); scrollPane.setBounds(10, 11, 371, 206); frame.getContentPane().add(scrollPane); }