/** * A partir de un iterador de libros actualiza los resultados de un búsqueda donde se pueden * devolver libros. * * @param libros Iterador que apunta al primer libro del resultado de la búsqueda. */ public void actualizarListaAlquilados(Iterador<ILibro> libros) { panelCentral.removeAll(); anhanirLabeles(); int i = 0; if (libros != null) { while (libros.haySiguiente()) { ILibro libro = libros.darSiguiente(); panelCentral.add(new PanelLibroAlquilado(libro, principal)); i++; } if (i <= 5) layout.setRows(7); else { layout.setRows(i + 2); panelCentral.setSize(511, i * 146); } for (int j = i + 2; j < 6; j++) { JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); panelCentral.add(panel); } labelMostrarResultados.setText("Resultados de la búsqueda: " + i); panelCentral.repaint(); } }
// populate version for corrections public void showCorrectionTileUpgrades() { // deactivate correctionTokenMode and tokenmode correctionTokenMode = false; tokenMode = false; // activate upgrade panel upgradePanel.removeAll(); GridLayout panelLayout = (GridLayout) upgradePanel.getLayout(); List<TileI> tiles = orUIManager.tileUpgrades; if (tiles == null || tiles.size() == 0) { // reset to the number of elements panelLayout.setRows(defaultNbPanelElements); // set to position 0 scrollPane.getVerticalScrollBar().setValue(0); } else { // set to the max of available or the default number of elements panelLayout.setRows(Math.max(tiles.size() + 2, defaultNbPanelElements)); for (TileI tile : tiles) { BufferedImage hexImage = getHexImage(tile.getId()); ImageIcon hexIcon = new ImageIcon(hexImage); // Cheap n' Easy rescaling. hexIcon.setImage( hexIcon .getImage() .getScaledInstance( (int) (hexIcon.getIconWidth() * GUIHex.NORMAL_SCALE * 0.8), (int) (hexIcon.getIconHeight() * GUIHex.NORMAL_SCALE * 0.8), Image.SCALE_SMOOTH)); HexLabel hexLabel = new HexLabel(hexIcon, tile.getId()); hexLabel.setName(tile.getName()); hexLabel.setTextFromTile(tile); hexLabel.setOpaque(true); hexLabel.setVisible(true); hexLabel.setBorder(border); hexLabel.addMouseListener(this); upgradePanel.add(hexLabel); } } upgradePanel.add(doneButton); upgradePanel.add(cancelButton); // repaint(); revalidate(); }
private JPanel getJPanel1() { if (jPanel1 == null) { jPanel1 = new JPanel(); GridLayout jPanel1Layout = new GridLayout(7, 2); jPanel1Layout.setColumns(2); jPanel1Layout.setHgap(5); jPanel1Layout.setVgap(5); jPanel1Layout.setRows(7); jPanel1.setLayout(jPanel1Layout); jPanel1.add(getJLabel1()); jPanel1.add(getJTextField1()); jPanel1.add(getJLabel2()); jPanel1.add(getJTextField2()); jPanel1.add(getJLabel3()); jPanel1.add(getJTextField3()); jPanel1.add(getJLabel4()); jPanel1.add(getJTextField4()); jPanel1.add(getJLabel5()); jPanel1.add(getJTextField5()); jPanel1.add(getJLabel6()); jPanel1.add(getJTextField6()); jPanel1.add(getJLabel7()); jPanel1.add(getJTextField7()); } return jPanel1; }
/** * This method initializes jPanel * * @return JPanel */ private JPanel getJPanel() { if (jPanel == null) { jPanel = new JPanel(); java.awt.GridLayout layGridLayout7 = new java.awt.GridLayout(); layGridLayout7.setRows(4); layGridLayout7.setColumns(4); layGridLayout7.setHgap(10); layGridLayout7.setVgap(10); jPanel.setLayout(layGridLayout7); // Another way to do this, but wouldn't // have a visual in the editor. // for (int i = 1; i <= 16; i++) { // String label = String.valueOf(i); // JButton b = new JButton(label); // b.addMouseListener(buttonEvents); // b.addMouseMotionListener(buttonEvents); // jPanel.add(b); // } for (int i = 0; i < jButtons.length; i++) { jButtons[i] = createButton(String.valueOf(i + 1)); jPanel.add(jButtons[i], null); } jPanel.setBackground(java.awt.Color.white); jPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10)); } return jPanel; }
/** * This method initializes this * * @return void */ private void initialize() { this.setSize(400, (1) * 30); java.awt.GridLayout layGridLayout = new java.awt.GridLayout(); // Generated layGridLayout.setRows(1); // Generated this.setLayout(layGridLayout); // Generated this.add(getJPanelexten(), null); // Generated }
private void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20); contentPane.setBorder(border1); contentPane.setLayout(borderLayout1); controlsPane.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setHgap(10); gridLayout1.setRows(0); gridLayout1.setVgap(10); okButton.setVerifyInputWhenFocusTarget(true); okButton.setMnemonic('O'); okButton.setText("OK"); buttonsPane.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.CENTER); messagePane.setEditable(false); messagePane.setText(""); borderLayout1.setHgap(10); borderLayout1.setVgap(10); this.setTitle("Subscription Authorization"); this.getContentPane().add(contentPane, BorderLayout.CENTER); contentPane.add(controlsPane, BorderLayout.SOUTH); controlsPane.add(responsesComboBox, null); controlsPane.add(buttonsPane, null); buttonsPane.add(okButton, null); contentPane.add(messageScrollPane, BorderLayout.CENTER); messageScrollPane.getViewport().add(messagePane, null); }
/** * Component initialization. * * @throws java.lang.Exception */ private void jbInit() throws Exception { image1 = new ImageIcon(pt.inescporto.siasoft.MenuFrame.class.getResource("about.png")); imageLabel.setIcon(image1); setTitle("About"); panel1.setLayout(borderLayout1); panel2.setLayout(borderLayout2); insetsPanel1.setLayout(flowLayout1); insetsPanel2.setLayout(flowLayout1); insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); gridLayout1.setRows(4); gridLayout1.setColumns(1); label1.setText(product); label2.setText(version); label3.setText(copyright); label4.setText(comments); insetsPanel3.setLayout(gridLayout1); insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10)); button1.setText("OK"); button1.addActionListener(this); insetsPanel2.add(imageLabel, null); panel2.add(insetsPanel2, BorderLayout.WEST); getContentPane().add(panel1, null); insetsPanel3.add(label1, null); insetsPanel3.add(label2, null); insetsPanel3.add(label3, null); insetsPanel3.add(label4, null); panel2.add(insetsPanel3, BorderLayout.CENTER); insetsPanel1.add(button1, null); panel1.add(insetsPanel1, BorderLayout.SOUTH); panel1.add(panel2, BorderLayout.NORTH); setResizable(true); }
/** * Adds a component to the layout. * * @param name The name of the component to add. * @param component the component to add to the layout. */ public void addLayoutComponent(String name, Component component) { if (way == X_AXIS || (way == LINE_AXIS && component.getComponentOrientation().isHorizontal()) || (way == PAGE_AXIS && !component.getComponentOrientation().isHorizontal())) grid.setColumns(grid.getColumns() + 1); else grid.setRows(grid.getRows() + 1); }
private GridLayout createButtonPanelLayout() { GridLayout buttonPanelLayout = new GridLayout(2, 2); buttonPanelLayout.setColumns(2); buttonPanelLayout.setHgap(5); buttonPanelLayout.setVgap(5); buttonPanelLayout.setRows(2); return buttonPanelLayout; }
/** * This method initializes this * * @return void */ private void initialize() { this.setSize(400, (2) * 30); java.awt.GridLayout layGridLayout = new java.awt.GridLayout(); // Generated layGridLayout.setRows(2); // Generated this.setLayout(layGridLayout); // Generated this.add(getJPanelfamily(), null); // Generated this.add(getJPanelkeytree(), null); // Generated }
public void addCarrier(FireflyCarrier carrier) { list.add(carrier); add(carrier); int columns = (int) Math.floor(Math.sqrt(list.size())); gridLayout.setColumns(columns); gridLayout.setRows(list.size() / columns); updateUI(); }
/** * Removes a component from the layout. * * @param component The component to remove from the layout. */ public void removeLayoutComponent(Component component) { grid.removeLayoutComponent(component); if (way == X_AXIS || (way == LINE_AXIS && component.getComponentOrientation().isHorizontal()) || (way == PAGE_AXIS && !component.getComponentOrientation().isHorizontal())) grid.setColumns(grid.getColumns() - 1); else grid.setRows(grid.getRows() - 1); }
/** * This method initializes this * * @return void */ private void initialize() { this.setSize(400, (1) * 30); java.awt.GridLayout layGridLayout = new java.awt.GridLayout(); // Generated layGridLayout.setColumns(1); layGridLayout.setRows(1); // Generated this.setLayout(layGridLayout); // Generated this.add(getJPanelseconds(), null); // Generated initActions(); }
void addTextBox(String name, String currentValue) { configGridLayout.setRows(configGridLayout.getRows() + 1); addConfigLabel(name); JTextField textField = new JTextField(); textField.setText(currentValue); componentByName.put(name, textField); configPanel.add(textField); }
/** * This method initializes this * * @return void */ private void initialize() { this.setSize(400, (4) * 30); java.awt.GridLayout layGridLayout = new java.awt.GridLayout(); // Generated layGridLayout.setRows(4); // Generated this.setLayout(layGridLayout); // Generated this.add(getJPanelstatic_(), null); // Generated this.add(getJPanelwriteprotect(), null); // Generated this.add(getJPanelautofallthrough(), null); // Generated this.add(getJPanelclearglobalvars(), null); // Generated }
void addBooleanComponent(String name, boolean currentValue) { configGridLayout.setRows(configGridLayout.getRows() + 1); addConfigLabel(name); JCheckBox checkBox = new JCheckBox(); checkBox.setSelected(currentValue); componentByName.put(name, checkBox); configPanel.add(checkBox); }
/** * This method initializes this * * @return void */ private void initialize() { this.setSize(400, (4) * 30); java.awt.GridLayout layGridLayout = new java.awt.GridLayout(); // Generated layGridLayout.setColumns(1); layGridLayout.setRows(4); // Generated this.setLayout(layGridLayout); // Generated this.add(getJPanelfamily(), null); // Generated this.add(getJPanelcolmatch(), null); // Generated this.add(getJPanelvalue(), null); // Generated this.add(getJPanelprefix(), null); // Generated initActions(); }
/** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { GridLayout gridLayout = new GridLayout(); gridLayout.setRows(1); gridLayout.setColumns(2); jContentPane = new JPanel(); jContentPane.setLayout(gridLayout); jContentPane.add(getJPanel1(), null); jContentPane.add(getJPanel(), null); } return jContentPane; }
protected JComponent createButtonPanel() { GridLayout gridLayout = new GridLayout(); JPanel jPanelButtons = new JPanel(); jPanelButtons.setLayout(gridLayout); gridLayout.setRows(1); gridLayout.setHgap(10); gridLayout.setVgap(5); gridLayout.setColumns(buttons.length); for (int i = 0; i < buttons.length; i++) { jPanelButtons.add(buttons[i]); } return jPanelButtons; }
public void removeElement(PanelElementAbstract b) { int idx = panelElements.indexOf(b); if (idx >= 0) { panelElements.remove(idx); listPanel.remove(b.getPanel()); listLayout.setRows(Math.max(panelElements.size() + 1, minNbRows)); listPanel.revalidate(); listPanel.repaint(); setAddButtonColor(); if (ml != null) b.unRegister(ml); for (int i = idx; i < panelElements.size(); i++) panelElements.get(i).setIdx(idx); } }
/** * This method initializes jPanel * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridLayout gridLayout = new GridLayout(); gridLayout.setRows(1); gridLayout.setHgap(10); gridLayout.setVgap(10); gridLayout.setColumns(2); jPanel = new JPanel(); jPanel.setLayout(gridLayout); jPanel.add(getJButton(), null); jPanel.add(getJButton1(), null); } return jPanel; }
void buildConfigPanel() { try { Config config = playerObjects.getConfig(); for (Field field : config.getClass().getDeclaredFields()) { Annotation excludeAnnotation = field.getAnnotation(ReflectionHelper.Exclude.class); if (excludeAnnotation == null) { // so, this field is not excluded Class<?> fieldType = field.getType(); Method getMethod = getGetMethod(config.getClass(), field.getType(), field.getName()); if (getMethod != null) { Object value = getMethod.invoke(config); if (fieldType == String.class) { addTextBox(field.getName(), (String) value); } if (fieldType == boolean.class || fieldType == Boolean.class) { addBooleanComponent(field.getName(), (Boolean) value); } if (fieldType == float.class || fieldType == Float.class) { addTextBox(field.getName(), "" + value); } if (fieldType == int.class || fieldType == Integer.class) { addTextBox(field.getName(), "" + value); } } else { playerObjects .getLogFile() .WriteLine("No get accessor method for config field " + field.getName()); } } } } catch (Exception e) { playerObjects.getLogFile().WriteLine(Formatting.exceptionToStackTrace(e)); } configGridLayout.setRows(configGridLayout.getRows() + 2); configRevertButton = new JButton("Revert"); configReloadButton = new JButton("Reload"); configApplyButton = new JButton("Apply"); configSaveButton = new JButton("Save"); configRevertButton.addActionListener(new ConfigRevert()); configReloadButton.addActionListener(new ConfigReload()); configApplyButton.addActionListener(new ConfigApply()); configSaveButton.addActionListener(new ConfigSave()); configPanel.add(configRevertButton); configPanel.add(configReloadButton); configPanel.add(configApplyButton); configPanel.add(configSaveButton); }
/** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { GridLayout gridLayout = new GridLayout(); gridLayout.setRows(4); gridLayout.setColumns(1); jContentPane = new JPanel(); jContentPane.setLayout(gridLayout); jContentPane.add(getLblNewLabel()); jContentPane.add(getBoton3(), null); jContentPane.add(getBoton2(), null); jContentPane.add(getBoton1(), null); } return jContentPane; }
// populate version for corrections public void showCorrectionTokenUpgrades(MapCorrectionAction action) { // activate correctionTokenMode and deactivate standard tokenMode correctionTokenMode = true; tokenMode = false; // activate upgrade panel upgradePanel.removeAll(); GridLayout panelLayout = (GridLayout) upgradePanel.getLayout(); List<? extends TokenI> tokens = orUIManager.tokenLays; if (tokens == null || tokens.size() == 0) { // reset to the number of elements panelLayout.setRows(defaultNbPanelElements); // set to position 0 scrollPane.getVerticalScrollBar().setValue(0); } else { Color fgColour = null; Color bgColour = null; String text = null; String description = null; TokenIcon icon; CorrectionTokenLabel tokenLabel; correctionTokenLabels = new ArrayList<CorrectionTokenLabel>(); for (TokenI token : tokens) { if (token instanceof BaseToken) { PublicCompanyI comp = ((BaseToken) token).getCompany(); fgColour = comp.getFgColour(); bgColour = comp.getBgColour(); description = text = comp.getName(); } icon = new TokenIcon(25, fgColour, bgColour, text); tokenLabel = new CorrectionTokenLabel(icon, token); tokenLabel.setName(description); tokenLabel.setText(description); tokenLabel.setBackground(defaultLabelBgColour); tokenLabel.setOpaque(true); tokenLabel.setVisible(true); tokenLabel.setBorder(border); tokenLabel.addMouseListener(this); tokenLabel.addPossibleAction(action); correctionTokenLabels.add(tokenLabel); upgradePanel.add(tokenLabel); } } upgradePanel.add(doneButton); upgradePanel.add(cancelButton); // repaint(); revalidate(); }
/** * This method initializes jPanel_TitleArea * * @return javax.swing.JPanel */ private JPanel getJPanel_TitleArea() { if (jPanel_TitleArea == null) { GridLayout gridLayout = new GridLayout(); gridLayout.setRows(2); gridLayout.setHgap(0); gridLayout.setColumns(0); gridLayout.setVgap(10); jPanel_TitleArea = new JPanel(); jPanel_TitleArea.setLayout(gridLayout); jPanel_TitleArea.setName("jPanel2"); jPanel_TitleArea.add(jLabel_Title, null); jPanel_TitleArea.add(getJPanel_ExplArea1(), null); } return jPanel_TitleArea; }
@Override public void setNbChannel(final int nbChannel) { if (nbChannel >= 8) { _gridLayout.setRows(8); _middlePanel.add(_aux2Label); _middlePanel.add(_aux2Slider); _middlePanel.add(_aux3Label); _middlePanel.add(_aux3Slider); } if (nbChannel >= 10) { _gridLayout.setRows(12); _middlePanel.add(_aux4Label); _middlePanel.add(_aux4Slider); _middlePanel.add(_aux5Label); _middlePanel.add(_aux5Slider); } if (nbChannel >= 12) { _gridLayout.setRows(16); _middlePanel.add(_aux6Label); _middlePanel.add(_aux6Slider); _middlePanel.add(_aux7Label); _middlePanel.add(_aux7Slider); } }
/** * This method initializes jPanel_ExplArea2 * * @return javax.swing.JPanel */ private JPanel getJPanel_ExplArea2() { if (jPanel_ExplArea2 == null) { jLabal_SubExpl = new ExtendedLabel(); jLabal_SubExpl.setText(""); jLabal_SubExpl.setFont(new Font("Dialog", Font.PLAIN, 14)); GridLayout gridLayout1 = new GridLayout(); gridLayout1.setRows(2); jPanel_ExplArea2 = new JPanel(); jPanel_ExplArea2.setName("jPanel4"); jPanel_ExplArea2.setLayout(gridLayout1); jPanel_ExplArea2.add(jLabel_MainExpl, null); jPanel_ExplArea2.add(jLabal_SubExpl, null); } return jPanel_ExplArea2; }
/** * This method initializes legendPanel * * @return javax.swing.JPanel */ private JPanel getLegendPanel() { GridLayout gridLayout = new GridLayout(); gridLayout.setRows(2); gridLayout.setHgap(3); gridLayout.setVgap(3); gridLayout.setColumns(2); JPanel legendPanel = new JPanel(); legendPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3)); legendPanel.setLayout(gridLayout); addToLegend(legendPanel, "Key was found in base and compare file", Color.white); addToLegend(legendPanel, "Key was found in compare but not in base", Color.red); addToLegend(legendPanel, "Text for this key was changed but not saved yet", Color.orange); addToLegend(legendPanel, "Key was not found in compare file", Color.yellow); return legendPanel; }
/** * This method initializes this * * @return void */ private void initialize() { labelStatus = new JLabel(); labelStatus.setText("PARADO"); labelStatus.setFont(new Font("Dialog", Font.BOLD, 12)); labelStatus.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED); labelStatus.setForeground(Color.red); labelStatus.setHorizontalAlignment(SwingConstants.CENTER); GridLayout gridLayout = new GridLayout(); gridLayout.setRows(1); gridLayout.setColumns(2); this.setLayout(gridLayout); this.setSize(300, 28); this.add(getButtonIniciar(), null); this.add(getButtonParar(), null); this.add(labelStatus, null); }
public MonthPanel(DatePicker parent, Calendar c) { this.parent = parent; GridLayout g = new GridLayout(); g.setColumns(7); g.setRows(0); this.setLayout(g); for (int i = 0; i < 7; i++) { JLabel wd = new JLabel(parent.getString("week." + i, "")); wd.setHorizontalAlignment(SwingConstants.CENTER); if (i == 0) wd.setForeground(Color.RED); else if (i == 6) wd.setForeground(Color.gray); this.add(wd); } setDaysOfMonth(c); this.setPreferredSize(new Dimension(200, 120)); }