private void createControlPanel() { JPanel pnControls = new JPanel(); pnCopies.add(pnControls, BorderLayout.NORTH); pnControls.setLayout(new MigLayout("", "[][grow][][]", "[]")); lblNrOfCopies = new JLabel(); pnControls.add(lblNrOfCopies, "cell 0 0,alignx trailing"); txtValNrOfCopies = new JTextField(); txtValNrOfCopies.setEnabled(false); pnControls.add(txtValNrOfCopies, "flowx,cell 1 0"); txtValNrOfCopies.setColumns(10); btnAdd = new JButton(); btnAdd.setName(NAME_BUTTON_ADD_COPY); btnAdd.setMnemonic('a'); btnAdd.setIcon(IconUtil.loadIcon("add.gif")); pnControls.add(btnAdd, "cell 2 0"); btnRemove = new JButton(); btnRemove.setName(NAME_BUTTON_DELETE_COPY); btnRemove.setEnabled(false); btnRemove.setMnemonic('e'); btnRemove.setIcon(IconUtil.loadIcon("delete.gif")); pnControls.add(btnRemove, "cell 3 0"); }
public MenuPainel() { try { i = ImageIO.read(new File("21.jpg")); } catch (IOException e) { System.out.println(e.getMessage()); System.exit(1); } this.setLayout(null); JButton newgame = new JButton("Iniciar Jogo"); newgame.setBounds(20, 240, 200, 30); newgame.setName("NovoJogo"); newgame.addMouseListener(tt); JButton rules = new JButton("Regras"); rules.setBounds(20, 280, 200, 30); rules.setName("Regras"); rules.addMouseListener(tt); JButton exit = new JButton("Sair"); exit.setBounds(20, 320, 200, 30); exit.setName("Sair"); exit.addMouseListener(tt); this.add(newgame); this.add(rules); this.add(exit); }
public TargetSequencePanel(TargetListModel list_model) { this.list_model = list_model; list_model.addListDataListener(this); this.setLayout(new BorderLayout()); // set up the gui JPanel northPane = new JPanel(); northPane.setLayout(new FlowLayout(FlowLayout.LEADING)); JLabel label = new JLabel("Primary target transcript id:"); northPane.add(label); northPane.add(jtf_id); this.add(northPane, BorderLayout.NORTH); JPanel centerPane = new JPanel(); centerPane.setLayout(new BorderLayout()); label = new JLabel("Primary transcript sequence:"); centerPane.add(label, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(jta_seq); centerPane.add(scrollPane, BorderLayout.CENTER); jta_seq.setLineWrap(true); this.add(centerPane, BorderLayout.CENTER); JPanel bttn_pane = new JPanel(); JButton bttn_OK = new JButton("Save Change"); bttn_OK.addActionListener(this); bttn_OK.setName("Save"); bttn_pane.add(bttn_OK); JButton bttn_Cancel = new JButton("Cancel"); bttn_pane.setVisible(false); bttn_Cancel.addActionListener(this); bttn_Cancel.setName("Cancel"); bttn_pane.add(bttn_Cancel); this.add(bttn_pane, BorderLayout.SOUTH); }
@Override public ButtonPanel createButtonPanel() { ButtonPanel buttonPanel = new ButtonPanel(0); JButton okButton = new JButton(); JButton cancelButton = new JButton(); okButton.setName("OK"); cancelButton.setName("CANCEL"); buttonPanel.addButton(okButton, "AFFIRMATIVE"); buttonPanel.addButton(cancelButton, "CANCEL"); okButton.setAction( new AbstractAction(UIDefaultsLookup.getString("OptionPane.okButtonText")) { @Override public void actionPerformed(ActionEvent e) { ColumnOptionDialog.this.fnHideColumn(); ColumnOptionDialog.this.setDialogResult(0); ColumnOptionDialog.this.setVisible(false); ColumnOptionDialog.this.dispose(); } }); cancelButton.setAction( new AbstractAction(UIDefaultsLookup.getString("OptionPane.cancelButtonText")) { @Override public void actionPerformed(ActionEvent e) { ColumnOptionDialog.this.setDialogResult(-1); ColumnOptionDialog.this.setVisible(false); ColumnOptionDialog.this.dispose(); } }); setDefaultCancelAction(cancelButton.getAction()); setDefaultAction(okButton.getAction()); getRootPane().setDefaultButton(okButton); buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); return buttonPanel; }
/** Creates new form AnuncisModule */ public AnuncisModule() { this.moduleDescription = "Anuncis"; this.moduleDisplayName = "Anuncis"; this.moduleName = "anuncis"; this.multipleInstance = false; initComponents(); jLinkButton1.setIcon( new ImageIcon(AnuncisModule.class.getResource("/org/iesapp/framework/icons/down.gif"))); ButtonGroup buttonGroup2 = new ButtonGroup(); buttonGroup2.add(jRadioButtonMenuItem1); buttonGroup2.add(jRadioButtonMenuItem2); buttonNouAnunci = new JButton(); buttonNouAnunci.setToolTipText("Nou anunci"); buttonNouAnunci.setName("nouanunci"); buttonNouAnunci.setIcon( new ImageIcon( AnuncisModule.class.getResource("/org/iesapp/modules/anuncis/icons/insert.gif"))); buttonNouAnunci.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ShefEditor dlg = new ShefEditor(javar.JRDialog.getActiveFrame(), true, cfg); AnunciBean ba = new AnunciBean(); ba.setAuthor(cfg.getCoreCfg().getUserInfo().getName()); dlg.setBean(ba); screenSize = Toolkit.getDefaultToolkit().getScreenSize(); dlg.setSize((int) (screenSize.width * 0.8), (int) (screenSize.height * 0.9)); dlg.setLocationRelativeTo(null); dlg.setVisible(true); fillList(); } }); buttonConfigure = new JButton(); buttonConfigure.setToolTipText("Preferències"); buttonConfigure.setName("configure"); buttonConfigure.setIcon( new ImageIcon(getClass().getResource("/org/iesapp/modules/anuncis/icons/configIcon.gif"))); buttonConfigure.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Preferences dlg = new Preferences(AnuncisModule.this, true, cfg); dlg.setLocationRelativeTo(null); dlg.setVisible(true); } }); }
private void addWidgets() { start = new JButton("Start server"); stop = new JButton("Stop server"); start.setName("start"); stop.setName("stop"); start.addActionListener(this); stop.addActionListener(this); panel.add(start); panel.add(stop); }
private void setupToolBar() // {{{ { toolbar.setFloatable(false); toolbar.setRollover(true); toolbar.setName("listToolbar"); // NOI18N toolbar.setPreferredSize(new java.awt.Dimension(100, 18)); btnPrev.setIcon(resourceMap.getIcon("btnPrev.icon")); // NOI18N btnPrev.setText(resourceMap.getString("btnPrev.text")); // NOI18N btnPrev.setToolTipText(resourceMap.getString("btnPrev.toolTipText")); // NOI18N btnPrev.setFocusable(false); btnPrev.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btnPrev.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrev.setName("btnPrev"); // NOI18N btnPrev.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); toolbar.add(btnPrev); jSeparator3.setMaximumSize(new java.awt.Dimension(1000, 10)); jSeparator3.setName("jSeparator3"); // NOI18N toolbar.add(jSeparator3); btnAddList.setAction(actionMap.get("addNewList")); btnAddList.setText(resourceMap.getString("btnAddList.text")); btnAddList.setIcon(resourceMap.getIcon("btnAddList.icon")); btnAddList.setToolTipText(resourceMap.getString("btnAddList.toolTipText")); btnAddList.setMargin(new java.awt.Insets(2, 2, 2, 2)); toolbar.add(btnAddList); btnDeleteList.setAction(actionMap.get("deleteList")); btnDeleteList.setText(resourceMap.getString("btnDeleteList.text")); btnDeleteList.setIcon(resourceMap.getIcon("btnDeleteList.icon")); btnDeleteList.setToolTipText(resourceMap.getString("btnDeleteList.toolTipText")); btnDeleteList.setMargin(new java.awt.Insets(2, 2, 2, 2)); toolbar.add(btnDeleteList); separatorRight.setMaximumSize(new java.awt.Dimension(1000, 10)); separatorRight.setName("separatorRight"); // NOI18N toolbar.add(separatorRight); btnNext.setIcon(resourceMap.getIcon("btnNext.icon")); // NOI18N btnNext.setToolTipText(resourceMap.getString("btnNext.toolTipText")); // NOI18N btnNext.setFocusable(false); btnNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btnNext.setLabel(resourceMap.getString("btnNext.label")); // NOI18N btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnNext.setName("btnNext"); // NOI18N btnNext.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); toolbar.add(btnNext); } // }}}
private void initGUI() { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { panelFondo = new JPanel(); getContentPane().add(panelFondo, BorderLayout.CENTER); panelFondo.setLayout(null); { jLnombrePersonaje = new JLabel(); panelFondo.add(jLnombrePersonaje); jLnombrePersonaje.setText("Nombre"); jLnombrePersonaje.setBounds(17, 26, 94, 27); } { jTFNombrePersonaje = new JTextField(); panelFondo.add(jTFNombrePersonaje); jTFNombrePersonaje.setBounds(129, 12, 230, 41); jTFNombrePersonaje.setName("JTFNombreNuevoPersonaje"); } { jLDescripcion = new JLabel(); panelFondo.add(jLDescripcion); jLDescripcion.setText("Descripcion"); jLDescripcion.setBounds(17, 82, 104, 35); } { jTFDescripcion = new JTextArea(); panelFondo.add(jTFDescripcion); jTFDescripcion.setBounds(121, 82, 238, 93); jTFDescripcion.setName("JTFDescripcionNuevoPersonaje"); } { jBAceptar = new JButton(); panelFondo.add(jBAceptar); jBAceptar.setText("Aceptar"); jBAceptar.setName("JBAceptarNuevoPerosnaje"); jBAceptar.setBounds(56, 212, 112, 23); } { jBCancelar = new JButton(); panelFondo.add(jBCancelar); jBCancelar.setText("Cancelar"); jBCancelar.setName("JBCancelarNuevoPersonaje"); jBCancelar.setBounds(217, 212, 121, 23); } } pack(); setSize(400, 300); }
private void makeUI() { JComponent[] variableComponents = createComponents(PROPERTY_VARIABLE_NAME, TextFieldEditor.class); final TableLayout layout = new TableLayout(2); layout.setTablePadding(4, 3); layout.setCellWeightX(0, 1, 1.0); layout.setCellWeightX(1, 1, 1.0); layout.setCellWeightX(2, 0, 1.0); layout.setCellColspan(2, 0, 2); layout.setTableFill(TableLayout.Fill.HORIZONTAL); final JPanel panel = new JPanel(layout); panel.add(variableComponents[1]); panel.add(variableComponents[0]); JLabel expressionLabel = new JLabel("Variable expression:"); JTextArea expressionArea = new JTextArea(); expressionArea.setRows(3); TextComponentAdapter textComponentAdapter = new TextComponentAdapter(expressionArea); bindingContext.bind(PROPERTY_EXPRESSION, textComponentAdapter); panel.add(expressionLabel); panel.add(layout.createHorizontalSpacer()); panel.add(expressionArea); JButton editExpressionButton = new JButton("Edit Expression..."); editExpressionButton.setName("editExpressionButton"); editExpressionButton.addActionListener(createEditExpressionButtonListener()); panel.add(layout.createHorizontalSpacer()); panel.add(editExpressionButton); setContent(panel); }
/** * This method initializes btnOK * * @return javax.swing.JButton */ private JButton getBtnOK() { if (btnOK == null) { btnOK = new JButton(); btnOK.setName("btnOK"); btnOK.setText("OK"); btnOK.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { try { validateParam(); saveParam(); exitResult = JOptionPane.OK_OPTION; AbstractParamDialog.this.setVisible(false); } catch (Exception ex) { View.getSingleton().showWarningDialog(ex.getMessage()); } } }); } return btnOK; }
@Override public void actionPerformed(ActionEvent ae) { pakkaNappi.setEnabled(true); avoPakkaNappi.setEnabled(true); for (JButton nappi : vuoro.getPelaaja().getKorttiNapit()) { if (nappi.getName() == null) { avoPakkaNappi.setText(pokeri.pakanPaallimmainen.toString()); Kortti kortti = pokeri.koneKaantaaKortin(vuoro.getKasi()); nappi.setText(kortti.toString()); KorttienMaalaaja.maalaaNappi(pokeri, kortti, nappi); nappi.setName("painettu"); nappi.doClick(); break; } } vuoro.seuraava(); NappiHallinto.piilotaMuidenPelaajienNapit(pokeri, vuoro); lopetaPeliLopussa(pokeri, frame, avoPakkaNappi, pakkaNappi); KoneToiminta.luoJaPainaaKoneNappia(pokeri, frame, vuoro, avoPakkaNappi, pakkaNappi); if (!frame.getTitle().equals("Piilopokeri")) { frame.dispose(); } }
@Override protected void startup() { timePanel = new JPanel(); btnShowTime = new JButton(); txtShowTime = new JTextField(); // Set UI component names so that the // framework can inject resources automatically into // these components. Resources come from similarly // named keys in resources/ShowTimeApp.properties btnShowTime.setName("btnShowTime"); txtShowTime.setName("txtShowTime"); btnShowTime.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Date now = new Date(); txtShowTime.setText(now.toString()); } }); timePanel.add(btnShowTime); timePanel.add(txtShowTime); show(timePanel); }
/** * Simple test. * * @author nschuste * @version 1.0.0 * @throws InterruptedException * @since Feb 23, 2016 */ @Test(timeout = 10000) public void test() throws InterruptedException { final Map<String, Object> mp = new HashMap<>(); mp.put("abc", new TextDispatcher()); Mockito.when(this.context.getBeansWithAnnotation(Matchers.any())).thenReturn(mp); final JFrame frame = new JFrame(); final JTextField b = new JTextField(); b.setName("xyz"); final JButton c = new JButton(); c.setName("cc"); frame.getContentPane().add(b); frame.getContentPane().add(c); frame.pack(); frame.setVisible(true); final JTextComponentFixture fix = new JTextComponentFixture(this.r, "xyz"); final JButtonFixture fix2 = new JButtonFixture(this.r, "cc"); this.dispatcher.initialize(this.lstr); final ArgumentCaptor<TestCaseStep> captor = ArgumentCaptor.forClass(TestCaseStep.class); fix.enterText("hello"); fix2.focus(); try { SwingUtilities.invokeAndWait(() -> {}); } catch (final InvocationTargetException e) { e.printStackTrace(); } Mockito.verify(this.lstr, Mockito.times(1)).event(captor.capture()); final TestCaseStep capt = captor.getValue(); Assert.assertEquals(capt.getMethodName(), "text.enter"); Assert.assertEquals(capt.getArgs().length, 2); Assert.assertEquals(capt.getArgs()[0], "xyz"); Assert.assertEquals(capt.getArgs()[1], "hello"); }
/** * Initializes the UI components. * * @param title Pass <code>true</code> to display the title, <code>false</code> otherwise. */ private void initComponents(boolean title) { if (editor != null) editor.addPropertyChangeListener(this); cancelButton = new JButton("Cancel"); cancelButton.setName("cancel button"); cancelButton.setToolTipText("Close the window."); finishButton = new JButton("Apply"); finishButton.setName("apply button"); finishButton.setEnabled(false); getRootPane().setDefaultButton(finishButton); // layer hosting title and empty message IconManager icons = IconManager.getInstance(); if (title) { titleLayer = new JLayeredPane(); titlePanel = new TitlePanel(TITLE, TEXT, icons.getIcon(IconManager.CONFIG_48)); } }
public SerPortProperties( JFrame frame, String inNodeName, String inNodeInt, Simulation Sim, SandBox SBox) { super(frame); this.NodeName = inNodeName; this.NodeInt = inNodeInt; setResizable(false); controller = (MainScreen) frame; this.Sim = Sim; setTitle("WAN Port Properties"); initGUI(inNodeName, inNodeInt); final JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.SOUTH); btnOk = new JButton(); btnOk.setEnabled(true); btnOk.setToolTipText("Set options!"); btnOk.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { okButton(); } }); btnOk.setName("btnOK"); panel.add(btnOk); btnOk.setText("OK"); final JButton btnCancel = new JButton(); btnCancel.setToolTipText("Cancel changes"); btnCancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { cancelButton(); } }); btnCancel.setName("btnCancel"); panel.add(btnCancel); btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); this.setVisible(true); }
public void fillWordList() { sf = new ScrollField(new Dimension(250, 300)); sf.setBounds(20, 250, 250, 300); ResultSet result = DatabaseController.getInstance() .runQuery("SELECT woord FROM woordenboek where status='Pending'"); try { // Onderstaande if(); word al in logics afgehandeld // if(result.next()==false) // { // this.getGui().showMessage("No words in pending list"); // } result.beforeFirst(); while (result.next()) { // System.out.println(result.next()); // create word panel ColoredRectangle wordPanel = new ColoredRectangle(new Rectangle(sf.getWidth(), 50), Color.gray); // create word label JLabel wordLabel = new JLabel(result.getString("woord")); wordLabel.setForeground(Color.white); wordLabel.setBounds(0, 0, 550, 50); wordLabel.setFont(FontController.getInstance().getFont("segoeuil")); wordLabel.setFont(new Font(wordLabel.getFont().getName(), Font.BOLD, 20)); // add label to panel wordPanel.add(wordLabel); // create edit buttonimage ImageIcon editLogo = new ImageIcon(getClass().getResource("/Assets/Images/edit.png")); JButton editButton = new JButton(editLogo); editButton.setBackground(Color.gray); editButton.setBounds( wordPanel.getWidth() - (editLogo.getIconWidth() + 10), wordPanel.getHeight() - 15 - editLogo.getIconHeight(), editLogo.getIconWidth() + 3, editLogo.getIconHeight() + 3); editButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); editButton.setName("btnWordOutList#" + result.getString("woord")); // addclickevent editButton.addActionListener(logics); // add editlabel to wordpanel wordPanel.add(editButton); wordPanel.setLayout(null); // add wordpanel to scollfield sf.addElement(wordPanel); } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } this.add(sf); }
private JButton getJButton2() { if (jButton2 == null) { jButton2 = new JButton(cup); jButton2.setName("end"); jButton2.addActionListener(this); jButton2.setBounds(341, 17, 14, 10); } return jButton2; }
private void createButtonsPanel(JPanel pnValidationContainer) { JPanel pnButtons = new JPanel(); pnButtons.setLayout(new MigLayout("", "[grow][][][]", "[23px]")); lblMessage = new JLabel(); pnButtons.add(lblMessage, "cell 1 0,alignx right"); btnSave = new JButton(); pnButtons.add(btnSave, "cell 2 0,alignx left,aligny top"); btnSave.setMnemonic('s'); btnSave.setName(NAME_BUTTON_SAVE); pnValidationContainer.add(pnButtons, BorderLayout.SOUTH); btnCancel = new JButton(); pnButtons.add(btnCancel, "cell 3 0,alignx left,aligny top"); btnCancel.setName(NAME_BUTTON_CANCEL); btnCancel.setMnemonic('c'); }
private JButton createColorBarButton(BarGraph barGraph, int index) { // Button JButton colorBtn = new JButton(); colorBtn.setName(String.valueOf(index)); colorBtn.setFont(FONT_SMALL); colorBtn.addActionListener(this); colorBtn.setBackground(barGraph.getBackColor()); return colorBtn; }
public JButton getJBSalir() { if (jbSalir == null) { jbSalir = new JButton(); jbSalir.setText("Salir"); jbSalir.setName("Salir"); jbSalir.setBounds(new Rectangle(685, 420, 100, 30)); } return jbSalir; }
public JButton getJBBuscar() { if (jbBuscar == null) { jbBuscar = new JButton(); jbBuscar.setText("Buscar"); jbBuscar.setName("Buscar"); jbBuscar.setBounds(new Rectangle(260, 50, 80, 22)); } return jbBuscar; }
public JButton getJBModificar() { if (jbModif == null) { jbModif = new JButton(); jbModif.setName("Modificar"); jbModif.setText("Modificar"); jbModif.setBounds(new Rectangle(130, 25, 100, 25)); } return jbModif; }
public JButton getJBEliminar() { if (jbEliminar == null) { jbEliminar = new JButton(); jbEliminar.setName("Eliminar"); jbEliminar.setText("Eliminar"); jbEliminar.setBounds(new Rectangle(245, 25, 100, 25)); } return jbEliminar; }
public JButton getJBVer() { if (jbVer == null) { jbVer = new JButton(); jbVer.setName("Ver Dx"); jbVer.setText("Ver Dx"); jbVer.setBounds(new Rectangle(15, 25, 100, 25)); } return jbVer; }
@Override public ButtonPanel createButtonPanel() { ButtonPanel buttonPanel = new ButtonPanel(); JButton okButton = new JButton(); JButton cancelButton = new JButton(); JButton helpButton = new JButton(); okButton.setName(OK); cancelButton.setName(CANCEL); helpButton.setName(HELP); buttonPanel.addButton(okButton, ButtonPanel.AFFIRMATIVE_BUTTON); buttonPanel.addButton(cancelButton, ButtonPanel.CANCEL_BUTTON); buttonPanel.addButton(helpButton, ButtonPanel.HELP_BUTTON); okButton.setAction( new AbstractAction(UIDefaultsLookup.getString("OptionPane.okButtonText")) { public void actionPerformed(ActionEvent e) { setDialogResult(RESULT_AFFIRMED); setVisible(false); dispose(); } }); cancelButton.setAction( new AbstractAction(UIDefaultsLookup.getString("OptionPane.cancelButtonText")) { public void actionPerformed(ActionEvent e) { setDialogResult(RESULT_CANCELLED); setVisible(false); dispose(); } }); final ResourceBundle resourceBundle = ButtonResources.getResourceBundle(Locale.getDefault()); helpButton.setAction( new AbstractAction(resourceBundle.getString("Button.help")) { public void actionPerformed(ActionEvent e) { // do something } }); helpButton.setMnemonic(resourceBundle.getString("Button.help.mnemonic").charAt(0)); setDefaultCancelAction(cancelButton.getAction()); setDefaultAction(okButton.getAction()); getRootPane().setDefaultButton(okButton); buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); return buttonPanel; }
/* create a new button and add the respective coordinates */ public void createNewButton(int x, int y) { this.x = x; // Autoboxing! this.y = y; button = new JButton(); button.setPreferredSize(new Dimension(20, 20)); // for leftclicks button.setActionCommand(this.x.toString() + " " + this.y.toString()); // for rightclicks button.setName(this.x.toString() + " " + this.y.toString()); }
private List<JComponent> getRandomizedList(int difficulty) { List<JComponent> componentSet = new ArrayList<JComponent>(); for (int i = 0; i < difficulty * difficulty - 1; i++) { JButton button = new JButton("" + (i + 1)); button.setName("" + i); componentSet.add(button); } componentSet.add(new JPanel()); return componentSet; }
private JButton getJButton1() { if (jButton1 == null) { jButton1 = new JButton(cup); jButton1.setName("start"); jButton1.addActionListener(this); jButton1.setBounds(173, 18, 14, 10); } return jButton1; }
protected JPanel buildLeftButtonPanel() { JPanel pnl = new JPanel(); pnl.setLayout(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); gc.gridx = 0; gc.gridy = 0; copyStartLeftAction = new CopyStartLeftAction(); JButton btn = new JButton(copyStartLeftAction); btn.setName("button.copystartleft"); pnl.add(btn, gc); gc.gridx = 0; gc.gridy = 1; copyBeforeCurrentLeftAction = new CopyBeforeCurrentLeftAction(); btn = new JButton(copyBeforeCurrentLeftAction); btn.setName("button.copybeforecurrentleft"); pnl.add(btn, gc); gc.gridx = 0; gc.gridy = 2; copyAfterCurrentLeftAction = new CopyAfterCurrentLeftAction(); btn = new JButton(copyAfterCurrentLeftAction); btn.setName("button.copyaftercurrentleft"); pnl.add(btn, gc); gc.gridx = 0; gc.gridy = 3; copyEndLeftAction = new CopyEndLeftAction(); btn = new JButton(copyEndLeftAction); btn.setName("button.copyendleft"); pnl.add(btn, gc); gc.gridx = 0; gc.gridy = 4; copyAllLeft = new CopyAllLeft(); btn = new JButton(copyAllLeft); btn.setName("button.copyallleft"); pnl.add(btn, gc); return pnl; }
public JFrameComandi(Mediator mediator) { panelText = new JPanel(); panelText.setLayout(new BorderLayout()); panelText.setBackground(Color.white); panelButton = new JPanel(); panelButton.setBackground(Color.white); dimensione = Toolkit.getDefaultToolkit().getScreenSize(); setTitle("Comandi"); txa = new JTextArea(); txa.setEditable(false); txa.setText(text); txa.setFont(new Font("Ariel", Font.PLAIN, dimensione.height / 55)); txa.setLineWrap(true); txa.setWrapStyleWord(true); ok = new JButton("ESCI"); ok.setName("okComandi"); ok.setFont(new Font("Ariel", Font.PLAIN, dimensione.height / 50)); panelText.add(txa, BorderLayout.CENTER); panelButton.add(ok, BorderLayout.CENTER); mediator.manageEvent(new ActionEvent(ok, Counter.generateID(), null)); pack(); setResizable(false); setSize(new Dimension(dimensione.width / 3, dimensione.height / 3)); add(panelText, BorderLayout.CENTER); add(panelButton, BorderLayout.SOUTH); setAlwaysOnTop(true); setLocationRelativeTo(null); setVisible(false); setDefaultCloseOperation(DISPOSE_ON_CLOSE); }