/** * 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); }
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); }
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(); }
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); }
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); }
public void buildGUI() { theFrame = new JFrame("Cyber BeatBox"); theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); BorderLayout layout = new BorderLayout(); JPanel background = new JPanel(layout); background.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); checkboxList = new ArrayList<JCheckBox>(); Box buttonBox = new Box(BoxLayout.Y_AXIS); JButton start = new JButton("Start"); start.addActionListener(new MyStartListener()); buttonBox.add(start); JButton stop = new JButton("Stop"); stop.addActionListener(new MyStopListener()); buttonBox.add(stop); JButton upTempo = new JButton("Tempo Up"); upTempo.addActionListener(new MyUpTempoListener()); buttonBox.add(upTempo); JButton downTempo = new JButton("Tempo Down"); downTempo.addActionListener(new MyDownTempoListener()); buttonBox.add(downTempo); Box nameBox = new Box(BoxLayout.Y_AXIS); for (int i = 0; i < 16; i++) { nameBox.add(new Label(instrumentNames[i])); } background.add(BorderLayout.EAST, buttonBox); background.add(BorderLayout.WEST, nameBox); theFrame.getContentPane().add(background); GridLayout grid = new GridLayout(16, 16); grid.setVgap(1); grid.setHgap(2); mainPanel = new JPanel(grid); background.add(BorderLayout.CENTER, mainPanel); for (int i = 0; i < 256; i++) { JCheckBox c = new JCheckBox(); c.setSelected(false); checkboxList.add(c); mainPanel.add(c); } // end loop setUpMidi(); theFrame.setBounds(50, 50, 300, 300); theFrame.pack(); theFrame.setVisible(true); } // close method
// 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(); }
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); }
// 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(); }
// ------------------------------------------------------------------------------------------------ // 描述: // 设计: Skyline(2001.12.29) // 实现: Skyline // 修改: // ------------------------------------------------------------------------------------------------ private void jbInit() throws Exception { bnAutoColor.setFont(new java.awt.Font("Dialog", 0, 12)); bnAutoColor.setActionCommand("bnAutoColor"); bnAutoColor.setText(res.getString("String_3")); jPanel1.setLayout(borderLayout1); jPanel3.setLayout(gridLayout1); gridLayout1.setColumns(8); gridLayout1.setRows(7); jPanel2.setLayout(borderLayout2); this.getContentPane().add(jPanel1, BorderLayout.CENTER); jPanel1.add(jPanel3, BorderLayout.CENTER); jPanel1.add(jPanel2, BorderLayout.NORTH); jPanel2.add(bnAutoColor, BorderLayout.CENTER); // this.setDefaultCloseOperation(); setSize(200, 220); setTitle(res.getString("String_4")); this.addWindowFocusListener(this); InitButton(); }
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); } }
public CalculatorPanel() { result = 0; lastCommand = "+"; ActionListener command = new CommandAction(); GridLayout layout = new GridLayout(2, 5); layout.setHgap(5); layout.setVgap(5); panel = new JPanel(); panel.setLayout(layout); panel.setPreferredSize(new Dimension(400, 200)); // add display display = new JTextField(); Command = new JTextField("+"); firstNumber = new JTextField(); secondNumber = new JTextField(); JTextField equal = new JTextField("="); equal.setEnabled(false); display.setEnabled(false); Command.setEnabled(false); panel.add(firstNumber); panel.add(Command); panel.add(secondNumber); panel.add(equal); panel.add(display); addButton("+", command); addButton("-", command); addButton("*", command); addButton("/", command); addButton("OK", command); add(panel, BorderLayout.CENTER); }
protected void addElement(BasicDBObject DBO, int idx) { try { PanelElementAbstract b = createPanelElement(DBO, idx); if (ml != null) b.register(ml); panelElements.add(b); if (template != null) { if (template.panelElements.size() > idx) { if (b instanceof PanelElementPlugin) ((PanelElementPlugin) b) .setTemplate((PanelElementPlugin) template.panelElements.get(idx)); } } listPanel.add(b.getPanel()); listLayout.setRows(Math.max(panelElements.size() + 1, minNbRows)); listPanel.revalidate(); // scrollPane.getViewport().revalidate(); panelDisplayer.refreshDisplay(); setAddButtonColor(); } catch (Exception e) { exceptionPrinter.print(e, "", Core.GUIMode); } }
/** * Initializes the dialog by displaying all labels and sliders, setting title, creating buttons * and assigning an ActionListener. To arrange the elements of the dialog box, a GridLayout is * used. */ private void initWebCrawlingDialog() { this.setTitle("Meta-Data-Related Web Crawling - Configuration"); // assign text to buttons, set name and assign action listener btnStartWebCrawl.setMnemonic(KeyEvent.VK_S); // set "Crawl"-button as default this.getRootPane().setDefaultButton(btnStartWebCrawl); btnStartWebCrawl.setText("Start Crawling"); btnStartWebCrawl.addActionListener(this); btnCancel.setText("Cancel"); btnCancel.setMnemonic(KeyEvent.VK_C); btnCancel.addActionListener(this); // set default values for text fields tfSearchEngineURL.setText("http://www.google.com"); tfAdditionalKeywords.setText("+music+review"); tfPathExternalCrawler.setText("wget"); // create and initialize sliders sliderNumberOfRetries.setMinorTickSpacing(1); sliderIntervalBetweenRetries.setMinorTickSpacing(1); // initialize labels for slider values currentNumberOfRetries = new JLabel(Integer.toString(sliderNumberOfRetries.getValue()), JLabel.CENTER); currentIntervalBetweenRetries = new JLabel(Integer.toString(sliderIntervalBetweenRetries.getValue()), JLabel.CENTER); // initialize button group for placement of additional keywords in search string panelAdditionalKeywordsPlacement.add(rbBeforeSearchString); panelAdditionalKeywordsPlacement.add(rbAfterSearchString); bgAdditionalKeywordsPlacement.add(rbBeforeSearchString); bgAdditionalKeywordsPlacement.add(rbAfterSearchString); rbBeforeSearchString.setMnemonic(KeyEvent.VK_B); rbAfterSearchString.setMnemonic(KeyEvent.VK_A); // assign change listeners sliderNumberOfRetries.addChangeListener(this); sliderIntervalBetweenRetries.addChangeListener(this); // init grid layout gridLayout.setRows(10); gridLayout.setVgap(0); // assign layout panel.setLayout(gridLayout); panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // add UI-elements getContentPane().add(panel); panel.add(new JLabel("URL of Search Engine")); panel.add(tfSearchEngineURL); panel.add(new JLabel()); panel.add(new JLabel("Number of Retries")); panel.add(sliderNumberOfRetries); panel.add(currentNumberOfRetries); panel.add(new JLabel("Interval between Retries (sec)")); panel.add(sliderIntervalBetweenRetries); panel.add(currentIntervalBetweenRetries); panel.add(new JLabel("Additional Keywords")); panel.add(tfAdditionalKeywords); panel.add(panelAdditionalKeywordsPlacement); panel.add(new JLabel("Maximum Number of Retrieved Pages per Query")); panel.add(jsNumberOfPages); panel.add(new JLabel()); panel.add(new JLabel("Storage Path for Retrieved Pages")); panel.add(tfPathStoreRetrievedPages); panel.add(new JLabel()); panel.add(new JLabel("Command for External Crawler")); panel.add(tfPathExternalCrawler); panel.add(new JLabel()); panel.add(new JLabel()); panel.add(cbStoreURLList); panel.add(new JLabel()); panel.add(new JLabel()); panel.add(new JLabel()); panel.add(new JLabel()); panel.add(btnStartWebCrawl); panel.add(new JLabel()); panel.add(btnCancel); // set default look and feel this.setUndecorated(true); this.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); this.setResizable(false); }
public GraphPanel() { gridLayout.setHgap(2); gridLayout.setVgap(2); setLayout(gridLayout); }
private void jbInit() throws Exception { this.setWidth(700); this.setHeight(450); this.setDeviceType("ST133"); this.setDeviceProvider("150.178.3.33"); this.setDeviceTitle("ST133 CCD Controller"); this.getContentPane().setLayout(borderLayout1); jPanel1.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setRows(4); jPanel2.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.LEFT); flowLayout1.setHgap(5); flowLayout1.setVgap(0); flowLayout2.setVgap(0); flowLayout2.setHgap(5); flowLayout2.setAlignment(FlowLayout.LEFT); jPanel3.setLayout(flowLayout2); flowLayout3.setVgap(0); flowLayout3.setHgap(5); flowLayout3.setAlignment(FlowLayout.LEFT); jPanel4.setLayout(flowLayout3); flowLayout4.setVgap(0); flowLayout4.setHgap(5); flowLayout4.setAlignment(FlowLayout.LEFT); jPanel5.setLayout(flowLayout4); deviceField1.setOffsetNid(1); deviceField1.setLabelString("Comment: "); deviceField1.setNumCols(30); deviceField1.setIdentifier(""); deviceField2.setOffsetNid(2); deviceField2.setTextOnly(true); deviceField2.setLabelString("Ip Address: "); deviceField2.setIdentifier(""); deviceChoice1.setChoiceIntValues(null); deviceChoice1.setChoiceFloatValues(null); deviceChoice1.setOffsetNid(3); deviceChoice1.setLabelString("Clock Mode: "); deviceChoice1.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL"}); deviceChoice1.setUpdateIdentifier(""); deviceChoice1.setIdentifier(""); deviceField3.setOffsetNid(4); deviceField3.setLabelString("Clock. Source: "); deviceField3.setNumCols(30); deviceField3.setIdentifier(""); deviceField4.setOffsetNid(14); deviceField4.setLabelString("Exp. Time: "); deviceField4.setNumCols(15); deviceField4.setIdentifier(""); deviceField5.setOffsetNid(18); deviceField5.setLabelString("Num. Frames:"); deviceField5.setIdentifier(""); deviceButtons1.setMethods(new String[] {"init", "store"}); deviceField6.setOffsetNid(16); deviceField6.setLabelString("Cleans: "); deviceField6.setIdentifier(""); deviceField7.setOffsetNid(17); deviceField7.setLabelString("Skip Cleans: "); deviceField7.setIdentifier(""); deviceField8.setOffsetNid(19); deviceField8.setLabelString("Num. ROI"); deviceField8.setIdentifier(""); deviceTable1.setOffsetNid(20); deviceTable1.setNumCols(6); deviceTable1.setNumRows(10); deviceTable1.setIdentifier(""); deviceTable1.setColumnNames( new String[] {"StartX", "EndX", "GroupX", "StartY", "EndY", "GroupY"}); deviceTable1.setRowNames(null); deviceTable1.setDisplayRowNumber(true); this.getContentPane().add(deviceButtons1, BorderLayout.SOUTH); this.getContentPane().add(jPanel1, BorderLayout.NORTH); jPanel1.add(jPanel2, null); jPanel2.add(deviceField1, null); jPanel2.add(deviceField2, null); jPanel1.add(jPanel3, null); jPanel3.add(deviceChoice1, null); jPanel3.add(deviceField3, null); jPanel1.add(jPanel4, null); jPanel4.add(deviceField5, null); jPanel4.add(deviceField4, null); jPanel4.add(deviceDispatch1, null); jPanel1.add(jPanel5, null); jPanel5.add(deviceField6, null); jPanel5.add(deviceField7, null); jPanel5.add(deviceField8, null); this.getContentPane().add(deviceTable1, BorderLayout.CENTER); }
public void showUpgrades() { upgradePanel.removeAll(); // reset to the number of elements GridLayout panelLayout = (GridLayout) upgradePanel.getLayout(); panelLayout.setRows(defaultNbPanelElements); if (tokenMode && possibleTokenLays != null && possibleTokenLays.size() > 0) { Color fgColour = null; Color bgColour = null; String text = null; String description = null; TokenIcon icon; ActionLabel tokenLabel; tokenLabels = new ArrayList<ActionLabel>(); for (LayToken action : possibleTokenLays) { if (action instanceof LayBaseToken) { PublicCompanyI comp = ((LayBaseToken) action).getCompany(); fgColour = comp.getFgColour(); bgColour = comp.getBgColour(); description = text = comp.getName(); if (action.getSpecialProperty() != null) { description += " (" + action.getSpecialProperty().getOriginalCompany().getName() + ")"; } } else if (action instanceof LayBonusToken) { fgColour = Color.BLACK; bgColour = Color.WHITE; BonusToken token = (BonusToken) action.getSpecialProperty().getToken(); description = token.getName(); text = "+" + token.getValue(); } icon = new TokenIcon(25, fgColour, bgColour, text); tokenLabel = new ActionLabel(icon); tokenLabel.setName(description); tokenLabel.setText(description); tokenLabel.setBackground(defaultLabelBgColour); tokenLabel.setOpaque(true); tokenLabel.setVisible(true); tokenLabel.setBorder(border); tokenLabel.addMouseListener(this); tokenLabel.addPossibleAction(action); tokenLabels.add(tokenLabel); upgradePanel.add(tokenLabel); } setSelectedToken(); } else if (orUIManager.tileUpgrades == null) {; } else if (orUIManager.tileUpgrades.size() == 0) { orUIManager.setMessage(LocalText.getText("NoTiles")); } else { for (TileI tile : orUIManager.tileUpgrades) { BufferedImage hexImage = getHexImage(tile.getPictureId()); 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 void jbInit() throws Exception { border1 = BorderFactory.createRaisedBevelBorder(); jPanel1.setLayout(gridLayout1); panel2.setBorder(border1); panel2.setMaximumSize(new Dimension(400, 200)); panel2.setMinimumSize(new Dimension(400, 200)); panel2.setLayout(gridBagLayout2); button1.setText("OK"); button1.addActionListener(new insertMapDialog_button1_actionAdapter(this)); button2.setText("Cancel"); gridLayout1.setHgap(4); button2.addActionListener(new insertMapDialog_button2_actionAdapter(this)); this.addWindowListener(new insertMapDialog_this_windowAdapter(this)); InsertMapPanel.setLayout(gridBagLayout1); upperLeftLabel.setHorizontalAlignment(SwingConstants.RIGHT); upperLeftLabel.setText("Upper-left Hex:"); headerLabel.setText("Please enter the hex where the upper-left "); upperLeftTextField.setText("A1"); jLabel1.setText("corner of the selected map will be placed:"); InsertMapPanel.add( jPanel1, new GridBagConstraints( 0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(4, 8, 4, 8), 0, 0)); jPanel1.add(button1, null); jPanel1.add(button2, null); InsertMapPanel.add( panel2, new GridBagConstraints( 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 2), 0, 0)); panel2.add( upperLeftLabel, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(20, 118, 4, 12), 88, 5)); panel2.add( headerLabel, new GridBagConstraints( 0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(-7, 186, 0, 156), 69, 12)); panel2.add( upperLeftTextField, new GridBagConstraints( 1, 2, 1, 2, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(17, 0, 0, 0), 65, 0)); panel2.add( jLabel1, new GridBagConstraints( 0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 16, 0, 0), 225, 0)); getContentPane().add(InsertMapPanel); panel2.setPreferredSize(new Dimension(400, 200)); this.validate(); }
private void jbInit() throws Exception { this.setWidth(580); this.setHeight(450); this.setDeviceType("CADH"); this.setDeviceProvider("localhost"); this.setDeviceTitle("INCAA CADH 4 Channels Transient Recorder"); this.getContentPane().setLayout(borderLayout1); jPanel1.setLayout(borderLayout2); deviceChannel1.setLabelString("Ch1: "); deviceChannel1.setOffsetNid(10); deviceChannel1.setBorderVisible(true); deviceChannel1.setInSameLine(true); deviceChannel1.setUpdateIdentifier(""); deviceChannel1.setShowVal(""); deviceChannel1.setLayout(flowLayout1); jPanel3.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setRows(4); jPanel5.setLayout(flowLayout2); deviceField2.setOffsetNid(11); deviceField2.setLabelString("Start: "); deviceField2.setIdentifier(""); deviceField1.setOffsetNid(12); deviceField1.setLabelString("End: "); deviceField1.setIdentifier(""); deviceField3.setIdentifier(""); deviceField3.setLabelString("End: "); deviceField3.setOffsetNid(30); deviceChannel2.setLayout(flowLayout3); deviceChannel2.setShowVal(""); deviceChannel2.setUpdateIdentifier(""); deviceChannel2.setInSameLine(true); deviceChannel2.setBorderVisible(true); deviceChannel2.setOffsetNid(28); deviceChannel2.setLabelString("Ch4: "); jPanel6.setLayout(flowLayout4); deviceField4.setOffsetNid(29); deviceField4.setLabelString("Start: "); deviceField4.setIdentifier(""); deviceField5.setIdentifier(""); deviceField5.setLabelString("End: "); deviceField5.setOffsetNid(24); deviceChannel3.setLayout(flowLayout5); deviceChannel3.setShowVal(""); deviceChannel3.setUpdateIdentifier(""); deviceChannel3.setInSameLine(true); deviceChannel3.setBorderVisible(true); deviceChannel3.setOffsetNid(22); deviceChannel3.setLabelString("Ch3: "); jPanel7.setLayout(flowLayout6); deviceField6.setOffsetNid(23); deviceField6.setLabelString("Start: "); deviceField6.setIdentifier(""); deviceField7.setIdentifier(""); deviceField7.setLabelString("End: "); deviceField7.setOffsetNid(18); deviceChannel4.setLayout(flowLayout7); deviceChannel4.setShowVal(""); deviceChannel4.setUpdateIdentifier(""); deviceChannel4.setInSameLine(true); deviceChannel4.setBorderVisible(true); deviceChannel4.setOffsetNid(16); deviceChannel4.setLabelString("Ch2: "); jPanel8.setLayout(flowLayout8); deviceField8.setOffsetNid(17); deviceField8.setLabelString("Start: "); deviceField8.setIdentifier(""); jPanel4.setLayout(gridLayout2); gridLayout2.setColumns(1); gridLayout2.setRows(4); deviceChannel5.setLabelString("Ch1: "); deviceChannel5.setOffsetNid(10); deviceChannel5.setBorderVisible(true); deviceChannel5.setInSameLine(true); deviceChannel5.setUpdateIdentifier(""); deviceChannel5.setShowVal(""); deviceChannel5.setLayout(flowLayout14); jPanel9.setLayout(flowLayout9); deviceField10.setOffsetNid(13); deviceField10.setLabelString("Start Idx: "); deviceField10.setIdentifier(""); deviceField9.setOffsetNid(14); deviceField9.setLabelString("End Idx: "); deviceField9.setIdentifier(""); deviceField11.setIdentifier(""); deviceField11.setLabelString("Start Idx: "); deviceField11.setOffsetNid(31); deviceField12.setIdentifier(""); deviceField12.setLabelString("End Idx: "); deviceField12.setOffsetNid(32); jPanel10.setLayout(flowLayout10); deviceChannel6.setLabelString("Ch4: "); deviceChannel6.setOffsetNid(28); deviceChannel6.setBorderVisible(true); deviceChannel6.setInSameLine(true); deviceChannel6.setUpdateIdentifier(""); deviceChannel6.setShowVal(""); deviceChannel6.setLayout(flowLayout16); deviceField13.setIdentifier(""); deviceField13.setLabelString("Start Idx: "); deviceField13.setOffsetNid(25); deviceField14.setIdentifier(""); deviceField14.setLabelString("End Idx: "); deviceField14.setOffsetNid(26); jPanel11.setLayout(flowLayout11); deviceChannel7.setLabelString("Ch3: "); deviceChannel7.setOffsetNid(22); deviceChannel7.setBorderVisible(true); deviceChannel7.setInSameLine(true); deviceChannel7.setUpdateIdentifier(""); deviceChannel7.setShowVal(""); deviceChannel7.setLayout(flowLayout15); deviceField15.setIdentifier(""); deviceField15.setLabelString("Start Idx: "); deviceField15.setOffsetNid(19); deviceField16.setIdentifier(""); deviceField16.setLabelString("End Idx: "); deviceField16.setOffsetNid(20); jPanel12.setLayout(flowLayout12); deviceChannel8.setLabelString("Ch2: "); deviceChannel8.setOffsetNid(16); deviceChannel8.setBorderVisible(true); deviceChannel8.setInSameLine(true); deviceChannel8.setUpdateIdentifier(""); deviceChannel8.setShowVal(""); deviceChannel8.setLayout(flowLayout13); jPanel2.setLayout(gridLayout3); gridLayout3.setColumns(1); gridLayout3.setRows(4); deviceField17.setOffsetNid(1); deviceField17.setTextOnly(true); deviceField17.setLabelString("CAMAC Name: "); deviceField17.setIdentifier(""); deviceChoice1.setChoiceIntValues(null); deviceChoice1.setChoiceFloatValues(null); deviceChoice1.setOffsetNid(8); deviceChoice1.setLabelString("Use Time: "); deviceChoice1.setChoiceItems(new String[] {"TRUE", "FALSE"}); deviceChoice1.setUpdateIdentifier(""); deviceChoice1.setIdentifier(""); deviceField18.setOffsetNid(2); deviceField18.setTextOnly(true); deviceField18.setLabelString("Comment: "); deviceField18.setNumCols(35); deviceField18.setIdentifier(""); deviceField20.setOffsetNid(6); deviceField20.setLabelString("Clock Source: "); deviceField20.setNumCols(15); deviceField20.setIdentifier(""); deviceField19.setOffsetNid(5); deviceField19.setLabelString("Trig. Source: "); deviceField19.setNumCols(15); deviceField19.setIdentifier(""); deviceChoice4.setChoiceIntValues(null); deviceChoice4.setChoiceFloatValues(null); deviceChoice4.setOffsetNid(4); deviceChoice4.setLabelString("Clock Mode: "); deviceChoice4.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL"}); deviceChoice4.setUpdateIdentifier(""); deviceChoice4.setIdentifier(""); deviceChoice3.setChoiceIntValues(null); deviceChoice3.setChoiceFloatValues( new float[] { (float) 500000.0, (float) 250000.0, (float) 125000.0, (float) 50000.0, (float) 10000.0, (float) 5000.0, (float) 1000.0, (float) 500.0 }); deviceChoice3.setOffsetNid(7); deviceChoice3.setLabelString("Frequency: "); deviceChoice3.setChoiceItems( new String[] {"500E3", "250E3", "125E3", "50E3", "10E3", "5E3", "1E3", "500"}); deviceChoice3.setUpdateIdentifier(""); deviceChoice3.setIdentifier(""); deviceChoice2.setChoiceIntValues(new int[] {(int) 1, (int) 2, (int) 4}); deviceChoice2.setChoiceFloatValues(null); deviceChoice2.setOffsetNid(3); deviceChoice2.setLabelString("Num. Channels: "); deviceChoice2.setChoiceItems(new String[] {"1", "2", "4"}); deviceChoice2.setUpdateIdentifier(""); deviceChoice2.setIdentifier(""); deviceButtons1.setCheckExpressions(null); deviceButtons1.setCheckMessages(null); deviceButtons1.setMethods(new String[] {"INIT", "TRIGGER", "STORE"}); this.getContentPane().add(deviceButtons1, BorderLayout.SOUTH); this.getContentPane().add(jPanel1, BorderLayout.NORTH); jPanel1.add(jPanel2, BorderLayout.CENTER); jPanel2.add(jPanel13, null); jPanel13.add(deviceField17, null); jPanel13.add(deviceDispatch1, null); jPanel13.add(deviceChoice1, null); jPanel2.add(jPanel16, null); jPanel16.add(deviceField18, null); jPanel2.add(jPanel15, null); jPanel15.add(deviceField20, null); jPanel15.add(deviceField19, null); jPanel2.add(jPanel14, null); jPanel14.add(deviceChoice4, null); jPanel14.add(deviceChoice3, null); jPanel14.add(deviceChoice2, null); jPanel1.add(jTabbedPane1, BorderLayout.SOUTH); jTabbedPane1.add(jPanel3, "Channels (Time)"); jPanel3.add(deviceChannel1, null); deviceChannel1.add(jPanel5, null); jPanel5.add(deviceField2, null); jPanel5.add(deviceField1, null); jPanel3.add(deviceChannel4, null); deviceChannel4.add(jPanel8, null); jPanel8.add(deviceField8, null); jPanel8.add(deviceField7, null); jPanel3.add(deviceChannel3, null); deviceChannel3.add(jPanel7, null); jPanel7.add(deviceField6, null); jPanel7.add(deviceField5, null); jPanel3.add(deviceChannel2, null); deviceChannel2.add(jPanel6, null); jPanel6.add(deviceField4, null); jPanel6.add(deviceField3, null); jTabbedPane1.add(jPanel4, "Channels (Samples)"); jPanel4.add(deviceChannel5, null); deviceChannel5.add(jPanel9, null); jPanel9.add(deviceField10, null); jPanel9.add(deviceField9, null); jPanel4.add(deviceChannel8, null); deviceChannel8.add(jPanel12, null); jPanel12.add(deviceField15, null); jPanel12.add(deviceField16, null); jPanel4.add(deviceChannel7, null); deviceChannel7.add(jPanel11, null); jPanel11.add(deviceField13, null); jPanel11.add(deviceField14, null); jPanel4.add(deviceChannel6, null); deviceChannel6.add(jPanel10, null); jPanel10.add(deviceField11, null); jPanel10.add(deviceField12, null); }
public FenetreAdministration( ListeUtilisateursImpl userlist, Utilisateur userConnected, File fileSave) { super("Application"); this.userlist = userlist; this.userConnected = userConnected; this.fileSave = fileSave; JPanel main = new JPanel(); main.setLayout(new BorderLayout()); JMenuBar menubar = new JMenuBar(); JMenu file = new JMenu("Fichier"); JMenu gestion = new JMenu("Gestion"); ajouter = new JMenuItem("Ajouter"); supprimer = new JMenuItem("Supprimer"); listeUtilisateurP3 = new JMenuItem("Lister les utilisateurs dans P3"); listeUtilisateurP4 = new JMenuItem("Lister les utilisateurs dans P4"); propos = new JMenuItem("A propos"); quitter = new JMenuItem("Quitter"); file.setMnemonic(KeyEvent.VK_F); gestion.setMnemonic(KeyEvent.VK_G); menubar.add(file); menubar.add(gestion); gestion.add(ajouter); gestion.add(supprimer); gestion.add(listeUtilisateurP3); gestion.add(listeUtilisateurP4); file.add(propos); file.add(quitter); setJMenuBar(menubar); GridLayout mainGrid = new GridLayout(2, 3); mainGrid.setHgap(15); // 5 pixels d'espace entre les colonnes (H comme Horizontal) mainGrid.setVgap(15); // main.setLayout(mainGrid); P1 = new PanelAjouter(); P2 = new PanelSupprimer(); P3 = new PanelListeUtilisateur(); P4 = new PanelListeUtilisateur(); JPanel P5 = new JPanel(); JPanel P6 = new JPanel(); P1.setLayout(new BorderLayout()); P2.setLayout(new BorderLayout()); P3.setLayout(new BorderLayout()); P4.setLayout(new BorderLayout()); P5.setLayout(new BorderLayout()); P6.setLayout(new BorderLayout()); TitledBorder titleNorthBorder = new TitledBorder("P1"); titleNorthBorder.setTitleFont(new Font("Arial", Font.BOLD, 15)); P1.setBorder(titleNorthBorder); P2.setBorder(BorderFactory.createLineBorder(Color.black)); TitledBorder titleNorthBorder2 = new TitledBorder("P2"); titleNorthBorder2.setTitleFont(new Font("Arial", Font.BOLD, 15)); P2.setBorder(titleNorthBorder2); TitledBorder titleNorthBorder3 = new TitledBorder("P3"); titleNorthBorder3.setTitleFont(new Font("Arial", Font.BOLD, 15)); P3.setBorder(titleNorthBorder3); TitledBorder titleNorthBorder4 = new TitledBorder("P4"); titleNorthBorder4.setTitleFont(new Font("Arial", Font.BOLD, 15)); P4.setBorder(titleNorthBorder4); TitledBorder titleNorthBorder5 = new TitledBorder("P5"); titleNorthBorder5.setTitleFont(new Font("Arial", Font.BOLD, 15)); P5.setBorder(titleNorthBorder5); TitledBorder titleNorthBorder6 = new TitledBorder("P6"); titleNorthBorder6.setTitleFont(new Font("Arial", Font.BOLD, 15)); P6.setBorder(titleNorthBorder6); main.add(P1); main.add(P2); main.add(P3); main.add(P4); main.add(P5); main.add(P6); this.addWindowListener(new ListenerCloseWindow()); ListenerAdministration buttonlistener = new ListenerAdministration(this); this.propos.addActionListener(buttonlistener); this.quitter.addActionListener(buttonlistener); this.ajouter.addActionListener(buttonlistener); this.supprimer.addActionListener(buttonlistener); this.listeUtilisateurP3.addActionListener(buttonlistener); this.listeUtilisateurP4.addActionListener(buttonlistener); this.setContentPane(main); this.setVisible(true); this.setSize(1200, 600); }
public ImportDialog(boolean targetIsARow, String fileName) { Boolean targetIsARow1 = targetIsARow; contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); setContentPane(contentPane); JPanel panel3 = new JPanel(); panel3.setBackground(new Color(-1643275)); JLabel labelHeadline = new JLabel(Localization.lang("Import_Metadata_from:")); labelHeadline.setFont(new Font(labelHeadline.getFont().getName(), Font.BOLD, 14)); JLabel labelSubHeadline = new JLabel(Localization.lang("Choose_the_source_for_the_metadata_import")); labelSubHeadline.setFont( new Font(labelSubHeadline.getFont().getName(), labelSubHeadline.getFont().getStyle(), 13)); JLabel labelFileName = new JLabel(); labelFileName.setFont(new Font(labelHeadline.getFont().getName(), Font.BOLD, 14)); JPanel headLinePanel = new JPanel(); headLinePanel.add(labelHeadline); headLinePanel.add(labelFileName); headLinePanel.setBackground(new Color(-1643275)); GridLayout gl = new GridLayout(2, 1); gl.setVgap(10); gl.setHgap(10); panel3.setLayout(gl); panel3.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel3.add(headLinePanel); panel3.add(labelSubHeadline); radioButtonNoMeta = new JRadioButton(Localization.lang("Create_blank_entry_linking_the_PDF")); radioButtonXmp = new JRadioButton(Localization.lang("Create_entry_based_on_XMP_data")); radioButtonPDFcontent = new JRadioButton(Localization.lang("Create_entry_based_on_content")); radioButtononlyAttachPDF = new JRadioButton(Localization.lang("Only_attach_PDF")); JButton buttonOK = new JButton(Localization.lang("Ok")); JButton buttonCancel = new JButton(Localization.lang("Cancel")); checkBoxDoNotShowAgain = new JCheckBox(Localization.lang("Do not show this box again for this import")); useDefaultPDFImportStyle = new JCheckBox( Localization.lang("Always use this PDF import style (and do not ask for each import)")); DefaultFormBuilder b = new DefaultFormBuilder(new FormLayout("left:pref, 5dlu, left:pref:grow", "")); b.appendSeparator(Localization.lang("Create New Entry")); b.append(radioButtonNoMeta, 3); b.append(radioButtonXmp, 3); b.append(radioButtonPDFcontent, 3); b.appendSeparator(Localization.lang("Update_Existing_Entry")); b.append(radioButtononlyAttachPDF, 3); b.nextLine(); b.append(checkBoxDoNotShowAgain); b.append(useDefaultPDFImportStyle); b.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); bb.addButton(buttonOK); bb.addButton(buttonCancel); bb.addGlue(); bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); contentPane.add(panel3, BorderLayout.NORTH); contentPane.add(b.getPanel(), BorderLayout.CENTER); contentPane.add(bb.getPanel(), BorderLayout.SOUTH); if (!targetIsARow1) { this.radioButtononlyAttachPDF.setEnabled(false); } String name = new File(fileName).getName(); if (name.length() < 34) { labelFileName.setText(name); } else { labelFileName.setText(new File(fileName).getName().substring(0, 33) + "..."); } this.setTitle(Localization.lang("Import_Metadata_From_PDF")); setModal(true); getRootPane().setDefaultButton(buttonOK); // only one of the radio buttons may be selected. ButtonGroup bg = new ButtonGroup(); bg.add(radioButtonNoMeta); bg.add(radioButtonXmp); bg.add(radioButtonPDFcontent); bg.add(radioButtononlyAttachPDF); buttonOK.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onOK(); } }); buttonCancel.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onCancel(); } }); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { onCancel(); } }); contentPane.registerKeyboardAction( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); switch (Globals.prefs.getInt(ImportSettingsTab.PREF_IMPORT_DEFAULT_PDF_IMPORT_STYLE)) { case NOMETA: radioButtonNoMeta.setSelected(true); break; case XMP: radioButtonXmp.setSelected(true); break; case CONTENT: radioButtonPDFcontent.setSelected(true); break; case ONLYATTACH: radioButtononlyAttachPDF.setSelected(true); break; default: // fallback radioButtonPDFcontent.setSelected(true); break; } this.setSize(555, 371); }
private void jbInit() throws Exception { this.setWidth(529); this.setHeight(529); this.setDeviceType("WE900"); this.setDeviceProvider("localhost"); this.setDeviceTitle("YOKOGAWA Rack 9 Slots"); this.getContentPane().setLayout(null); jPanel1.setLayout(null); deviceField1.setOffsetNid(1); deviceField1.setLabelString("Comment: "); deviceField1.setNumCols(25); jPanel3.setLayout(flowLayout2); flowLayout2.setAlignment(FlowLayout.LEFT); flowLayout2.setHgap(0); flowLayout2.setVgap(0); deviceChoice1.setOffsetNid(6); deviceChoice1.setLabelString("Bus Trigger 2:"); deviceChoice1.setChoiceItems(new String[] {"SOFTWARE", "EXT I/O", "TRIGIN"}); jPanel4.setLayout(flowLayout3); flowLayout3.setAlignment(FlowLayout.LEFT); flowLayout3.setHgap(5); flowLayout3.setVgap(0); deviceField2.setOffsetNid(7); deviceField2.setLabelString("Source: "); deviceField2.setNumCols(20); flowLayout4.setAlignment(FlowLayout.LEFT); flowLayout4.setHgap(5); flowLayout4.setVgap(0); jPanel5.setLayout(flowLayout4); deviceChoice2.setOffsetNid(4); deviceChoice2.setLabelString("Bus Trigger 1:"); deviceChoice2.setShowState(false); deviceChoice2.setChoiceItems(new String[] {"SOFTWARE", "EXT I/O", "TRIGIN"}); deviceField5.setOffsetNid(5); deviceField5.setLabelString("Source: "); deviceField5.setNumCols(20); deviceField6.setNumCols(20); deviceField6.setOffsetNid(10); deviceField6.setLabelString("Source: "); deviceChoice3.setChoiceItems(new String[] {"NONE", "EXT I/O", "TRIGIN"}); deviceChoice3.setOffsetNid(9); deviceChoice3.setLabelString("Cmn. Clock:"); flowLayout5.setAlignment(FlowLayout.LEFT); flowLayout5.setHgap(5); flowLayout5.setVgap(0); jPanel6.setLayout(flowLayout5); jPanel1.setPreferredSize(new Dimension(300, 500)); jPanel1.setBounds(new Rectangle(1, 2, 529, 396)); jScrollPane1.setDebugGraphicsOptions(0); jScrollPane1.setBounds(new Rectangle(15, 191, 488, 138)); deviceChoice4.setOffsetNid(8); deviceChoice4.setLabelString("Trigger Slope:"); deviceChoice4.setChoiceItems(new String[] {"POSITIVE", "NEGATIVE"}); flowLayout6.setAlignment(FlowLayout.LEFT); flowLayout6.setVgap(0); jPanel7.setLayout(flowLayout6); flowLayout1.setAlignment(FlowLayout.LEFT); flowLayout1.setHgap(0); flowLayout1.setVgap(0); deviceField3.setNumCols(15); deviceField3.setOffsetNid(2); deviceField3.setLabelString("Controller IP: "); jPanel2.setLayout(flowLayout1); jPanel3.setBounds(new Rectangle(2, 1, 524, 31)); jPanel5.setBounds(new Rectangle(1, 94, 564, 31)); jPanel6.setBounds(new Rectangle(2, 61, 578, 31)); jPanel4.setBounds(new Rectangle(3, 127, 565, 31)); jPanel7.setBounds(new Rectangle(4, 158, 216, 31)); jPanel2.setBounds(new Rectangle(7, 34, 572, 31)); deviceButtons1.setMethods(new String[] {"init", "arm", "turnOff"}); deviceButtons1.setBounds(new Rectangle(24, 347, 474, 35)); jPanel8.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setRows(9); deviceField9.setLabelString("Modules Linked"); deviceField9.setNumCols(10); deviceField9.setOffsetNid(32); deviceChoice7.setIdentifier(""); deviceChoice7.setChoiceItems(new String[] {"WE7275", "WE7116"}); deviceChoice7.setShowState(false); deviceChoice7.setLabelString("Module Type"); deviceChoice7.setOffsetNid(31); deviceChannel3.setInSameLine(true); deviceChannel3.setLabelString("Slot 07"); deviceChannel3.setOffsetNid(30); jPanel9.setLayout(flowLayout7); flowLayout7.setHgap(0); flowLayout7.setVgap(0); flowLayout8.setVgap(0); flowLayout8.setHgap(0); deviceField10.setOffsetNid(35); deviceField10.setLabelString("Modules Linked"); deviceField10.setIdentifier(""); deviceChoice8.setOffsetNid(34); deviceChoice8.setLabelString("Module Type"); deviceChoice8.setShowState(false); deviceChoice8.setChoiceItems(new String[] {"WE7275", "WE7116"}); deviceChoice8.setIdentifier(""); jPanel10.setLayout(flowLayout8); deviceChannel4.setInSameLine(true); deviceChannel4.setLabelString("Slot 08"); deviceChannel4.setOffsetNid(33); flowLayout9.setVgap(0); flowLayout9.setHgap(0); deviceField11.setOffsetNid(29); deviceField11.setLabelString("Modules Linked"); deviceField11.setNumCols(10); deviceChoice9.setOffsetNid(28); deviceChoice9.setLabelString("Module Type"); deviceChoice9.setShowState(false); deviceChoice9.setChoiceItems(new String[] {"WE7275", "WE7116"}); deviceChoice9.setIdentifier(""); jPanel14.setLayout(flowLayout9); deviceChannel5.setInSameLine(true); deviceChannel5.setLabelString("Slot 06"); deviceChannel5.setOffsetNid(27); deviceChannel5.setLines(1); flowLayout10.setVgap(0); flowLayout10.setHgap(0); deviceField12.setOffsetNid(14); deviceField12.setLabelString("Modules Linked"); deviceChoice10.setOffsetNid(13); deviceChoice10.setLabelString("Module Type"); deviceChoice10.setShowState(false); deviceChoice10.setChoiceItems(new String[] {"WE7275", "WE7116"}); deviceChoice10.setIdentifier(""); jPanel16.setLayout(flowLayout10); deviceChannel6.setInSameLine(true); deviceChannel6.setLabelString("Slot 01"); deviceChannel6.setOffsetNid(12); deviceChannel6.setLines(1); flowLayout11.setVgap(0); flowLayout11.setHgap(0); deviceField13.setOffsetNid(26); deviceField13.setLabelString("Modules Linked"); deviceField13.setIdentifier(""); deviceChoice11.setOffsetNid(25); deviceChoice11.setLabelString("Module Type"); deviceChoice11.setShowState(false); deviceChoice11.setChoiceItems(new String[] {"WE7275", "WE7116"}); deviceChoice11.setIdentifier(""); jPanel18.setLayout(flowLayout11); deviceChannel7.setInSameLine(true); deviceChannel7.setLabelString("Slot 05"); deviceChannel7.setOffsetNid(24); deviceChannel7.setLines(1); flowLayout12.setVgap(0); flowLayout12.setHgap(0); deviceField14.setOffsetNid(23); deviceField14.setLabelString("Modules Linked"); deviceField14.setIdentifier(""); deviceChoice12.setOffsetNid(22); deviceChoice12.setLabelString("Module Type"); deviceChoice12.setShowState(false); deviceChoice12.setChoiceItems(new String[] {"WE7275", "WE7116"}); deviceChoice12.setIdentifier(""); jPanel110.setLayout(flowLayout12); deviceChannel8.setInSameLine(true); deviceChannel8.setLabelString("Slot 04"); deviceChannel8.setOffsetNid(21); deviceChannel8.setLines(1); flowLayout13.setVgap(0); flowLayout13.setHgap(0); deviceField15.setOffsetNid(20); deviceField15.setLabelString("Modules Linked"); deviceField15.setIdentifier(""); deviceChoice13.setOffsetNid(19); deviceChoice13.setLabelString("Module Type"); deviceChoice13.setShowState(false); deviceChoice13.setChoiceItems(new String[] {"WE7275", "WE7116"}); deviceChoice13.setIdentifier(""); jPanel112.setLayout(flowLayout13); deviceChannel9.setInSameLine(true); deviceChannel9.setLabelString("Slot 03"); deviceChannel9.setOffsetNid(18); deviceChannel9.setLines(1); flowLayout14.setVgap(0); flowLayout14.setHgap(0); deviceField16.setOffsetNid(17); deviceField16.setLabelString("Modules Linked"); deviceField16.setNumCols(10); deviceChoice14.setOffsetNid(16); deviceChoice14.setLabelString("Module Type"); deviceChoice14.setShowState(false); deviceChoice14.setChoiceItems(new String[] {"WE7275", "WE7116"}); deviceChoice14.setIdentifier(""); jPanel114.setLayout(flowLayout14); deviceChannel10.setInSameLine(true); deviceChannel10.setLabelString("Slot 02"); deviceChannel10.setOffsetNid(15); deviceChannel10.setLines(1); deviceField4.setOffsetNid(3); deviceField4.setLabelString("Station IP:"); deviceField4.setNumCols(15); jPanel115.setLayout(flowLayout15); deviceField17.setOffsetNid(38); deviceField17.setLabelString("Modules Linked"); deviceField17.setIdentifier(""); deviceChannel11.setInSameLine(true); deviceChannel11.setLabelString("Slot 09"); deviceChannel11.setOffsetNid(36); deviceChoice15.setOffsetNid(37); deviceChoice15.setLabelString("Module Type"); deviceChoice15.setShowState(false); deviceChoice15.setChoiceItems(new String[] {"WE7275", "WE7116"}); deviceChoice15.setIdentifier(""); flowLayout15.setVgap(0); flowLayout15.setHgap(0); jPanel3.add(deviceField1, null); jPanel3.add(deviceDispatch1, null); jPanel1.add(deviceButtons1, null); jPanel1.add(jScrollPane1, null); jScrollPane1.getViewport().add(jPanel8, null); jPanel11.add(deviceChoice7, null); jPanel11.add(deviceField9, null); jPanel8.add(jPanel16, null); jPanel16.add(deviceChannel6, null); deviceChannel6.add(jPanel15, BorderLayout.EAST); jPanel15.add(deviceChoice10, null); jPanel15.add(deviceField12, null); jPanel116.add(deviceChoice15, null); jPanel116.add(deviceField17, null); jPanel8.add(jPanel114, null); jPanel114.add(deviceChannel10, null); deviceChannel10.add(jPanel113, BorderLayout.EAST); jPanel113.add(deviceChoice14, null); jPanel113.add(deviceField16, null); jPanel8.add(jPanel112, null); jPanel112.add(deviceChannel9, null); deviceChannel9.add(jPanel111, BorderLayout.EAST); jPanel111.add(deviceChoice13, null); jPanel111.add(deviceField15, null); jPanel8.add(jPanel110, null); jPanel110.add(deviceChannel8, null); deviceChannel8.add(jPanel19, BorderLayout.EAST); jPanel19.add(deviceChoice12, null); jPanel19.add(deviceField14, null); jPanel8.add(jPanel18, null); jPanel18.add(deviceChannel7, null); deviceChannel7.add(jPanel17, BorderLayout.EAST); jPanel17.add(deviceChoice11, null); jPanel17.add(deviceField13, null); jPanel8.add(jPanel14, null); jPanel14.add(deviceChannel5, null); deviceChannel5.add(jPanel13, BorderLayout.EAST); jPanel8.add(jPanel9, null); jPanel9.add(deviceChannel3, null); deviceChannel3.add(jPanel11, BorderLayout.EAST); jPanel13.add(deviceChoice9, null); jPanel13.add(deviceField11, null); jPanel8.add(jPanel10, null); jPanel10.add(deviceChannel4, null); deviceChannel4.add(jPanel12, BorderLayout.EAST); jPanel12.add(deviceChoice8, null); jPanel12.add(deviceField10, null); jPanel8.add(jPanel115, null); jPanel115.add(deviceChannel11, null); deviceChannel11.add(jPanel116, BorderLayout.EAST); jPanel1.add(jPanel7, null); jPanel7.add(deviceChoice4, null); jPanel6.add(deviceChoice3, null); jPanel6.add(deviceField6, null); jPanel1.add(jPanel4, null); jPanel1.add(jPanel5, null); jPanel5.add(deviceChoice2, null); jPanel5.add(deviceField5, null); jPanel4.add(deviceChoice1, null); jPanel4.add(deviceField2, null); jPanel1.add(jPanel6, null); jPanel1.add(jPanel2, null); jPanel2.add(deviceField3, null); jPanel2.add(deviceField4, null); jPanel1.add(jPanel3, null); this.getContentPane().add(jPanel1, null); }
/** @param parent Parent Frame of this panel */ public AdminView(tester parent) { padre = parent; try { // Start Setting the look and feel to nimbus for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, set gui to CrossPlatform try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (ClassNotFoundException a) { // TODO Auto-generated catch block } catch (InstantiationException b) { // TODO Auto-generated catch block } catch (IllegalAccessException c) { // TODO Auto-generated catch block } catch (UnsupportedLookAndFeelException d) { // TODO Auto-generated catch block } } try { // start up the controller control = new Controller(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } // make the panels JPanel total = new JPanel(new BorderLayout()); JPanel test = new JPanel(); JPanel users = new JPanel(); JPanel info = new JPanel(); // set any gaps i want Buttons.setVgap(10); Info.setHgap(20); // set layouts for the panels users.setLayout(List); test.setLayout(Buttons); info.setLayout(Info); // Set up the list listModel = new DefaultListModel<String>(); userList = new JList<String>(listModel); userList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // only one thing at a time userList.setVisibleRowCount(10); populateUsers(); // userList.setPreferredSize(new Dimension(200,200)); userList.setLayoutOrientation(JList.VERTICAL); // lists items vertically // put a scroll pane all up in JScrollPane userscroller = new JScrollPane( userList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); userscroller.setPreferredSize(new Dimension(200, 200)); // Initialize buttons add_user = new JButton("Add User"); add_user.setPreferredSize(new Dimension(100, 20)); delete_user = new JButton("Delete User"); delete_user.setPreferredSize(new Dimension(100, 20)); logout = new JButton("Logout"); logout.setPreferredSize(new Dimension(100, 20)); // add listeners add_user.addActionListener(this); add_user.setActionCommand("Add"); delete_user.addActionListener(this); delete_user.setActionCommand("Delete"); logout.addActionListener(this); logout.setActionCommand("Logout"); // add to panels test.add(add_user); test.add(delete_user); test.add(logout); test.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10)); // spacing! users.add(userscroller); users.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 10)); // spacing! total.add(users); // everything is contained in total total.add(test, BorderLayout.WEST); total.setBorder(BorderFactory.createRaisedSoftBevelBorder()); // nice border total.setBorder(BorderFactory.createTitledBorder("Welcome Admin")); add(total); }
private void jbInit() throws Exception { saveButton.setText("Save"); saveButton.addActionListener(new PrintfTemplateEditor_saveButton_actionAdapter(this)); cancelButton.setText("Cancel"); cancelButton.addActionListener(new PrintfTemplateEditor_cancelButton_actionAdapter(this)); this.setTitle(this.getTitle() + " Template Editor"); printfPanel.setLayout(gridBagLayout1); formatLabel.setFont(new java.awt.Font("DialogInput", 0, 12)); formatLabel.setText("Format String:"); buttonPanel.setLayout(flowLayout1); printfPanel.setBorder(BorderFactory.createEtchedBorder()); printfPanel.setMinimumSize(new Dimension(100, 160)); printfPanel.setPreferredSize(new Dimension(380, 160)); parameterPanel.setLayout(gridBagLayout2); parameterLabel.setText("Parameters:"); parameterLabel.setFont(new java.awt.Font("DialogInput", 0, 12)); parameterTextArea.setMinimumSize(new Dimension(100, 25)); parameterTextArea.setPreferredSize(new Dimension(200, 25)); parameterTextArea.setEditable(true); parameterTextArea.setText(""); insertButton.setMaximumSize(new Dimension(136, 20)); insertButton.setMinimumSize(new Dimension(136, 20)); insertButton.setPreferredSize(new Dimension(136, 20)); insertButton.setToolTipText( "insert the format in the format string and add parameter to list."); insertButton.setText("Insert Parameter"); insertButton.addActionListener(new PrintfTemplateEditor_insertButton_actionAdapter(this)); formatTextArea.setMinimumSize(new Dimension(100, 25)); formatTextArea.setPreferredSize(new Dimension(200, 15)); formatTextArea.setText(""); parameterPanel.setBorder(null); parameterPanel.setMinimumSize(new Dimension(60, 40)); parameterPanel.setPreferredSize(new Dimension(300, 40)); insertMatchButton.addActionListener( new PrintfTemplateEditor_insertMatchButton_actionAdapter(this)); insertMatchButton.setText("Insert Match"); insertMatchButton.setToolTipText( "insert the match in the format string and add parameter to list."); insertMatchButton.setPreferredSize(new Dimension(136, 20)); insertMatchButton.setMinimumSize(new Dimension(136, 20)); insertMatchButton.setMaximumSize(new Dimension(136, 20)); matchPanel.setPreferredSize(new Dimension(300, 40)); matchPanel.setBorder(null); matchPanel.setMinimumSize(new Dimension(60, 60)); matchPanel.setLayout(gridBagLayout3); InsertPanel.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setRows(2); gridLayout1.setVgap(0); InsertPanel.setBorder(BorderFactory.createEtchedBorder()); InsertPanel.setMinimumSize(new Dimension(100, 100)); InsertPanel.setPreferredSize(new Dimension(380, 120)); editorPane.setText(""); editorPane.addKeyListener(new PrintfEditor_editorPane_keyAdapter(this)); printfTabPane.addChangeListener(new PrintfEditor_printfTabPane_changeAdapter(this)); parameterPanel.add( insertButton, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(8, 6, 13, 8), 0, 10)); parameterPanel.add( paramComboBox, new GridBagConstraints( 0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(8, 8, 13, 0), 258, 11)); paramComboBox.setRenderer(new MyCellRenderer()); InsertPanel.add(matchPanel, null); InsertPanel.add(parameterPanel, null); buttonPanel.add(cancelButton, null); buttonPanel.add(saveButton, null); this.getContentPane().add(printfTabPane, BorderLayout.NORTH); this.getContentPane().add(InsertPanel, BorderLayout.CENTER); matchPanel.add( insertMatchButton, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(8, 6, 13, 8), 0, 10)); matchPanel.add( matchComboBox, new GridBagConstraints( 0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(8, 8, 13, 0), 258, 11)); printfPanel.add( parameterLabel, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(7, 5, 0, 5), 309, 0)); printfPanel.add( formatLabel, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 5, 0, 5), 288, 0)); printfPanel.add( formatTextArea, new GridBagConstraints( 0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6, 5, 0, 5), 300, 34)); printfPanel.add( parameterTextArea, new GridBagConstraints( 0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6, 5, 6, 5), 300, 34)); printfTabPane.addTab("Editor View", null, editorPanel, "View in Editor"); printfTabPane.addTab("Printf View", null, printfPanel, "Vies as Printf"); editorPane.setCharacterAttributes(PLAIN_ATTR, true); editorPane.addStyle("PLAIN", editorPane.getLogicalStyle()); editorPanel.getViewport().add(editorPane, null); this.getContentPane().add(buttonPanel, BorderLayout.SOUTH); buttonGroup.add(cancelButton); }