/** * Get the menu items to add to the menu bar, to get recent file functionality * * @return a List of JMenuItem and a JSeparator, representing recent files */ public static List<JComponent> getRecentFileMenuItems() { LinkedList<JComponent> menuItems = new LinkedList<JComponent>(); // Get the preference for the recent files for (int i = 0; i < NUMBER_OF_MENU_ITEMS; i++) { // Create the menu item JMenuItem recentFile = new JMenuItem(); // Use the index as the name, used when processing the action recentFile.setName(Integer.toString(i)); recentFile.addActionListener(ActionRouter.getInstance()); recentFile.setActionCommand(ActionNames.OPEN_RECENT); // Set the KeyStroke to use int shortKey = getShortcutKey(i); if (shortKey >= 0) { recentFile.setMnemonic(shortKey); } // Add the menu item menuItems.add(recentFile); } // Add separator as the last item JSeparator separator = new JSeparator(); separator.setVisible(false); menuItems.add(separator); // Update menu items to reflect recent files updateMenuItems(menuItems); return menuItems; }
/** Initialize the contents of the frame. */ @Override public void initializeGUI() { frame = new JFrame("CoW\t-\tWorking with Morphisms"); frame.setBounds(100, 100, 700, 550); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().setLayout(null); frame.setResizable(false); super.addFrame(frame); addButtons(); addLabels(); addFields(); addMorphismTable(); addMorphismTableListener(); addResultsPane(); // separators JSeparator verticalSeparator = new JSeparator(SwingConstants.VERTICAL); verticalSeparator.setBounds(339, 0, 16, 245); frame.getContentPane().add(verticalSeparator); JSeparator separator = new JSeparator(); separator.setBounds(6, 239, 688, 16); frame.getContentPane().add(separator); super.setFrame(frame); frame.setVisible(true); }
/** * Set the content and visibility of menu items and menu separator, based on the recent file * stored user preferences. */ private static void updateMenuItems(List<JComponent> menuItems) { // Assume no recent files boolean someRecentFiles = false; // Update the menu items for (int i = 0; i < NUMBER_OF_MENU_ITEMS; i++) { // Get the menu item JMenuItem recentFile = (JMenuItem) menuItems.get(i); // Find and set the file for this recent file command String recentFilePath = getRecentFile(i); if (recentFilePath != null) { File file = new File(recentFilePath); StringBuilder sb = new StringBuilder(60); if (i < 9) { sb.append(i + 1).append(" "); // $NON-NLS-1$ } sb.append(getMenuItemDisplayName(file)); recentFile.setText(sb.toString()); recentFile.setToolTipText(recentFilePath); recentFile.setEnabled(true); recentFile.setVisible(true); // At least one recent file menu item is visible someRecentFiles = true; } else { recentFile.setEnabled(false); recentFile.setVisible(false); } } // If there are some recent files, we must make the separator visisble // The separator is the last item in the list JSeparator separator = (JSeparator) menuItems.get(menuItems.size() - 1); separator.setVisible(someRecentFiles); }
@Override public void addSeparator() { super.addSeparator(new Dimension(5, 1)); JSeparator separator = new JSeparator(SwingConstants.VERTICAL); separator.setMaximumSize(new Dimension(10, 40)); add(separator); super.addSeparator(new Dimension(5, 1)); }
public static JSeparator createSeparator(int orientation, Color background, Color foreground) { JSeparator separator = new JSeparator(orientation); separator.setBackground(background); separator.setForeground(foreground); return separator; }
public Backup(Aafc main) { super(main); lblBackupRestore = new JLabel("Backup / Restore"); lblBackupRestore.setBounds(10, 11, 87, 14); add(lblBackupRestore); rb_backup = new JRadioButton("Backup"); rb_backup.setBounds(6, 32, 87, 23); add(rb_backup); rb_Restore = new JRadioButton("Restore"); rb_Restore.setBounds(6, 58, 87, 23); add(rb_Restore); b_go = new JButton("Go!"); b_go.setFont(new Font("Tahoma", Font.PLAIN, 14)); b_go.setBounds(111, 32, 121, 49); add(b_go); separator = new JSeparator(); separator.setBounds(10, 88, 222, 2); add(separator); lblInclude = new JLabel("Include:"); lblInclude.setBounds(10, 98, 46, 14); add(lblInclude); cb_all = new JCheckBox("All"); cb_all.setBounds(52, 94, 97, 23); add(cb_all); cb_apk = new JCheckBox(".apk's"); cb_apk.setBounds(10, 119, 97, 23); add(cb_apk); cb_obb = new JCheckBox(".obb's"); cb_obb.setBounds(10, 145, 97, 23); add(cb_obb); cb_Sdcard = new JCheckBox("SDcard"); cb_Sdcard.setBounds(135, 119, 97, 23); add(cb_Sdcard); cb_System = new JCheckBox("System"); cb_System.setBounds(135, 145, 97, 23); add(cb_System); separator_1 = new JSeparator(); separator_1.setBounds(10, 175, 222, 2); add(separator_1); label = new JLabel("Include:"); label.setBounds(10, 184, 46, 14); add(label); setVisible(true); }
private void prepareTileStoreInfoPanel() { final GridBagConstraints gbc_mapSource = new GridBagConstraints(); gbc_mapSource.insets = new Insets(5, 10, 5, 10); gbc_mapSource.anchor = GridBagConstraints.WEST; final GridBagConstraints gbc_mapTiles = new GridBagConstraints(); gbc_mapTiles.insets = gbc_mapSource.insets; gbc_mapTiles.anchor = GridBagConstraints.EAST; final GridBagConstraints gbc_eol = new GridBagConstraints(); gbc_eol.gridwidth = GridBagConstraints.REMAINDER; TileStore tileStore = TileStore.getInstance(); MapSourcesManager mapSourcesManager = MapSourcesManager.getInstance(); tileStoreInfoPanel.add(new JLabel("<html><b>Map source</b></html>"), gbc_mapSource); tileStoreInfoPanel.add(new JLabel("<html><b>Tiles</b></html>"), gbc_mapTiles); tileStoreInfoPanel.add(new JLabel("<html><b>Size</b></html>"), gbc_eol); ImageIcon trash = Utilities.loadResourceImageIcon("trash.png"); for (String name : tileStore.getAllStoreNames()) { String mapTileCountText = " ? "; String mapTileSizeText = " ? "; MapSource mapSource = mapSourcesManager.getSourceByName(name); final JLabel mapSourceNameLabel; if (mapSource != null) mapSourceNameLabel = new JLabel(name); else mapSourceNameLabel = new JLabel(name + " (unused)"); final JLabel mapTileCountLabel = new JLabel(mapTileCountText); final JLabel mapTileSizeLabel = new JLabel(mapTileSizeText); final JButton deleteButton = new JButton(trash); TileSourceInfoComponents info = new TileSourceInfoComponents(); info.name = name; info.countLabel = mapTileCountLabel; info.sizeLabel = mapTileSizeLabel; tileStoreInfoList.add(info); deleteButton.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); deleteButton.setToolTipText("Delete all stored " + name + " tiles."); deleteButton.addActionListener(new ClearTileCacheAction(name)); tileStoreInfoPanel.add(mapSourceNameLabel, gbc_mapSource); tileStoreInfoPanel.add(mapTileCountLabel, gbc_mapTiles); tileStoreInfoPanel.add(mapTileSizeLabel, gbc_mapTiles); tileStoreInfoPanel.add(deleteButton, gbc_eol); } JSeparator hr = new JSeparator(JSeparator.HORIZONTAL); hr.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.HORIZONTAL; tileStoreInfoPanel.add(hr, gbc); JLabel totalMapLabel = new JLabel("<html><b>Total</b></html>"); totalTileCountLabel = new JLabel("<html><b>??</b></html>"); totalTileSizeLabel = new JLabel("<html><b>??</b></html>"); tileStoreInfoPanel.add(totalMapLabel, gbc_mapSource); tileStoreInfoPanel.add(totalTileCountLabel, gbc_mapTiles); tileStoreInfoPanel.add(totalTileSizeLabel, gbc_mapTiles); }
public static JSeparator createToolBarSeparator() { JSeparator toolBarSeparator = new JSeparator(JSeparator.VERTICAL); Dimension dim = new Dimension(4, 22); toolBarSeparator.setPreferredSize(dim); toolBarSeparator.setSize(dim); toolBarSeparator.setMinimumSize(dim); toolBarSeparator.setMaximumSize(dim); return toolBarSeparator; }
// private URI[] getSelectedUriArray() { // URI[] selectedUriArray = new URI[selectedIdentifiers.length]; // for (int currentIndex = 0; currentIndex < selectedIdentifiers.length; currentIndex++) { // try { // selectedUriArray[currentIndex] = new // URI(graphPanel.getPathForElementId(selectedIdentifiers[currentIndex])); // } catch (URISyntaxException ex) { // bugCatcher.logError(ex); // // todo: warn user with a dialog // } // } // return selectedUriArray; // } @Override public void show(Component cmpnt, int i, int i1) { eventLocation = new Point(i, i1); // System.out.println("ContextMenu: " + i + ":" + i1); selectedIdentifiers = graphPanel.getSelectedIds(); int nonTransientNodeCount = 0; int transientNodeCount = 0; int graphicsIdentifierCount = 0; for (UniqueIdentifier uniqueIdentifier : selectedIdentifiers) { // check to see if these selectedIdentifiers are transent nodes and if they are then do not // allow the following menu items if (uniqueIdentifier.isGraphicsIdentifier()) { graphicsIdentifierCount++; } else if (uniqueIdentifier.isTransientIdentifier()) { transientNodeCount++; } else { nonTransientNodeCount++; } } boolean showNonTransientMenus; if (graphPanel.dataStoreSvg.diagramMode != DiagramMode.FreeForm) { duplicateEntitiesMenu.setEnabled(nonTransientNodeCount > 0); removeRelationEntityMenu.setEnabled(nonTransientNodeCount > 1); mergeEntitiesMenu.setEnabled(nonTransientNodeCount > 1); addRelationEntityMenu.setEnabled(nonTransientNodeCount > 1); setAsEgoMenuItem.setEnabled(nonTransientNodeCount > 0); addAsEgoMenuItem.setEnabled(nonTransientNodeCount > 0); removeEgoMenuItem.setEnabled( nonTransientNodeCount > 0); // todo: set these items based on the state of the selected entities, // //graphPanel.selectionContainsEgo()); addAsRequiredMenuItem.setEnabled(nonTransientNodeCount > 0); removeRequiredMenuItem.setEnabled(nonTransientNodeCount > 0); showNonTransientMenus = true; } else { showNonTransientMenus = false; } // hide/show the menus based on the diagram type removeRelationEntityMenu.setVisible(showNonTransientMenus); mergeEntitiesMenu.setVisible(showNonTransientMenus); duplicateEntitiesMenu.setVisible(showNonTransientMenus); addRelationEntityMenu.setVisible(showNonTransientMenus); setAsEgoMenuItem.setVisible(showNonTransientMenus); addAsEgoMenuItem.setVisible(showNonTransientMenus); removeEgoMenuItem.setVisible(showNonTransientMenus); addAsRequiredMenuItem.setVisible(showNonTransientMenus); removeRequiredMenuItem.setVisible(showNonTransientMenus); addEntityMenu.setVisible(showNonTransientMenus); jSeparator2.setVisible(showNonTransientMenus); jSeparator3.setVisible(showNonTransientMenus); deleteMenu.setEnabled( nonTransientNodeCount + graphicsIdentifierCount > 0 && transientNodeCount == 0); saveFileMenuItem.setEnabled(dataNodeLoader.nodesNeedSave()); super.show(cmpnt, i, i1); }
public void addToolbarSeparator() { JSeparator sep = new JSeparator(); sep.setOrientation(SwingConstants.VERTICAL); Dimension size = new Dimension(10, 25); sep.setMinimumSize(size); sep.setPreferredSize(size); sep.setMaximumSize(size); toolbar.add(sep); }
private JSeparator createButUpSeparator() { butUp.add(Box.createRigidArea(GV.DIM_RA)); JSeparator jSep = new JSeparator(); jSep.setOrientation(SwingConstants.VERTICAL); jSep.setMaximumSize(new Dimension(2, 18)); butUp.add(jSep); butUp.add(Box.createRigidArea(GV.DIM_RA)); return jSep; }
public DriverFrame() { super("311"); this.setSize(this.WIDTH, this.HEIGHT); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setResizable(false); this.getContentPane().setBackground(Color.GRAY); this.setLayout(new BorderLayout(10, 10)); this.bDiv = new JPanel(); this.tDiv = new JPanel(); this.add(this.bDiv, BorderLayout.SOUTH); this.add(this.tDiv, BorderLayout.NORTH); this.tDiv.add(new JLabel("COSC 311 - Driver Program")); this.bDiv.setLayout(new BoxLayout(this.bDiv, BoxLayout.Y_AXIS)); this.orderRadio = new JRadioButton[this.ORDER_RADIO_LABELS.length]; this.typeRadio = new JRadioButton[this.TYPE_RADIO_LABELS.length]; for (int i = 0; i < this.BUTTON_LABELS.length; i++) { if (i == this.BUTTON_LABELS.length - 1) { this.oRadio = new ButtonGroup(); for (int j = 0; j < this.ORDER_RADIO_LABELS.length; j++) { this.orderRadio[j] = new JRadioButton(this.ORDER_RADIO_LABELS[j]); this.orderRadio[j].addActionListener(this); this.oRadio.add(this.orderRadio[j]); this.bDiv.add(this.orderRadio[j]); } this.orderRadio[0].setSelected(true); JSeparator sep = new JSeparator(); sep.setMaximumSize(new Dimension(this.WIDTH * 2, 5)); this.bDiv.add(sep); this.tRadio = new ButtonGroup(); for (int j = 0; j < this.TYPE_RADIO_LABELS.length; j++) { this.typeRadio[j] = new JRadioButton(this.TYPE_RADIO_LABELS[j]); this.typeRadio[j].addActionListener(this); this.tRadio.add(this.typeRadio[j]); this.bDiv.add(this.typeRadio[j]); } this.typeRadio[0].setSelected(true); } JButton btn = new JButton(this.BUTTON_LABELS[i]); btn.addActionListener(this); btn.setMaximumSize(new Dimension(this.WIDTH, 25)); this.bDiv.add(btn); this.myStructure = new DataStructure(); } }
private void flipSeparators(Component c, int orientn) { if (c != null && c instanceof JToolBar && UIManager.getLookAndFeel().getName().toLowerCase().indexOf("windows") != -1) { JToolBar jtb = (JToolBar) c; Component comps[] = jtb.getComponents(); if (comps != null && comps.length > 0) { for (int i = 0; i < comps.length; i++) { try { Component component = comps[i]; if (component != null) { if (component instanceof JSeparator) { jtb.remove(component); JSeparator separ = new JSeparator(); if (orientn == SwingConstants.VERTICAL) { separ.setOrientation(SwingConstants.VERTICAL); separ.setMinimumSize(new Dimension(2, 6)); separ.setPreferredSize(new Dimension(2, 6)); separ.setMaximumSize(new Dimension(2, 100)); } else { separ.setOrientation(SwingConstants.HORIZONTAL); separ.setMinimumSize(new Dimension(6, 2)); separ.setPreferredSize(new Dimension(6, 2)); separ.setMaximumSize(new Dimension(100, 2)); } jtb.add(separ, i); } } } catch (Exception e) { e.printStackTrace(); } } } } }
public static JSeparator createSeparator(int orientation, int thickness, Color color) { JSeparator sep = new JSeparator(orientation); UIDefaults defaults = new UIDefaults(); defaults.put( "Separator[Enabled].backgroundPainter", new SkinSeparatorBackgroundPainter(SkinSeparatorBackgroundPainter.State.Enabled, color)); defaults.put("Separator.thickness", thickness); sep.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE); sep.putClientProperty("Nimbus.Overrides", defaults); return sep; }
/** Create the panel. */ public AccountPanel() { setLayout(null); setBackground(SystemColor.inactiveCaptionBorder); JSeparator separator = new JSeparator(); separator.setBounds(0, 49, 954, 8); add(separator); JLabel label = new JLabel("账号搜索:"); label.setFont(new Font("微软雅黑", Font.PLAIN, 14)); label.setBounds(24, 21, 74, 15); add(label); nameToSearch = new NumberField(12); nameToSearch.setBounds(108, 18, 204, 21); add(nameToSearch); nameToSearch.setColumns(10); btnSearch = new MyButton_LightBlue("搜索"); btnSearch.setBounds(375, 10, 120, 29); add(btnSearch); JLabel label_1 = new JLabel("账户信息:"); label_1.setFont(new Font("微软雅黑 Light", Font.PLAIN, 16)); label_1.setBounds(108, 84, 92, 29); add(label_1); JLabel label_2 = new JLabel("账号:"); label_2.setFont(new Font("微软雅黑", Font.PLAIN, 15)); label_2.setBounds(241, 141, 54, 29); add(label_2); nameField = new MyTextField(); nameField.setBounds(335, 146, 133, 21); add(nameField); nameField.setColumns(10); JLabel label_3 = new JLabel("余额:"); label_3.setFont(new Font("微软雅黑", Font.PLAIN, 15)); label_3.setBounds(241, 220, 54, 18); add(label_3); moneyField = new MyTextField(); moneyField.setColumns(10); moneyField.setBounds(335, 220, 133, 21); add(moneyField); nameField.setEditable(false); moneyField.setEditable(false); btnSearch.addActionListener(this); }
private void setupMenus() { JMenuBar menuBar = new JMenuBar(); JMenu menuFile = new JMenu("File"); menuFile.setMnemonic(KeyEvent.VK_F); JMenu menuEdit = new JMenu("Edit"); menuEdit.setMnemonic(KeyEvent.VK_E); JMenu menuView = new JMenu("View"); menuView.setMnemonic(KeyEvent.VK_V); JMenu menuModify = new JMenu("Modify"); menuModify.setMnemonic(KeyEvent.VK_M); JMenu menuHelp = new JMenu("Help"); menuHelp.setMnemonic(KeyEvent.VK_H); /*layout*/ setJMenuBar(menuBar); menuBar.add(menuFile); menuFile.add(new OpenExistingAction(this)); menuFile.add(new OpenFileAction(this)); menuFile.add(new JSeparator()); menuFile.add(new SaveAction(this)); JMenu saveAs = new JMenu("Save As"); menuFile.add(saveAs); saveAs.add(new SaveAsBlueprintAction(this, false)); saveAs.add(new SaveAsBlueprintAction(this, true)); saveAs.add(new SaveAsFileAction(this)); JSeparator menuFileStart = new JSeparator(); menuFileStart.setName("pluginsStartHere"); menuFile.add(menuFileStart); menuFile.add(new JSeparator()); menuFile.add(new QuitAction(this)); menuBar.add(menuEdit); menuEdit.add(new UndoAction(this)); menuEdit.add(new RedoAction(this)); menuEdit.add(new JSeparator()); menuBar.add(menuView); menuView.add(new JCheckBoxMenuItem(new PlainAction(this))); menuView.add(new JCheckBoxMenuItem(new AxisAction(this))); menuView.add(new JCheckBoxMenuItem(new DontDrawAction(this))); JSeparator viewFileStart = new JSeparator(); viewFileStart.setName("pluginsStartHere"); menuView.add(viewFileStart); menuBar.add(menuModify); menuBar.add(menuHelp); /*link*/ menuFile.addMenuListener(new PluginPopupListener(this, IBlocksPlugin.SUBTYPE_FILE)); menuEdit.addMenuListener(new PluginPopupListener(this, IBlocksPlugin.SUBTYPE_EDIT)); menuView.addMenuListener(new PluginPopupListener(this, IBlocksPlugin.SUBTYPE_VIEW)); menuModify.addMenuListener( new PluginPopupListener( this, IBlocksPlugin.SUBTYPE_MODIFY, IBlocksPlugin.SUBTYPE_GENERATE)); }
public void update() { graphicPanel.removeAll(); graphicPanel.add(title); graphicPanel.add(mainMenuButton); graphicPanel.add(refreshButton); graphicPanel.add(logoutButton); graphicPanel.setLayout(new FlowLayout()); JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL); separator.setPreferredSize(new Dimension(600, 10)); graphicPanel.add(separator); if (page.matches("main")) { graphicPanel.add(reportLocationButton); graphicPanel.add(loadShipmentButton); } else if (page.matches("reportloc")) { locationComboBox = new JComboBox(driver.getLocation().getNeighbours().toArray()); graphicPanel.add(locationComboBox); graphicPanel.add(reportButton); } else if (page.matches("loadShipment")) { shipmentList = new ArrayList<Shipment>(); for (int i = 0; i < driverService.getAssignedShipments().size(); ++i) { if (driverService.canPickup(driver, driverService.getAssignedShipments().get(i))) { shipmentList.add(driverService.getAssignedShipments().get(i)); } } Object[][] tableContent = new Object[shipmentList.size()][shipmentTableColumnTitles.length]; for (int i = 0; i < shipmentList.size(); ++i) { tableContent[i][0] = shipmentList.get(i).getType(); tableContent[i][1] = shipmentList.get(i).getApproximateWeight(); tableContent[i][2] = shipmentList.get(i).getDueDate(); tableContent[i][3] = shipmentList.get(i).getDestination(); } shipmentTable = new JTable(tableContent, shipmentTableColumnTitles); shipmentTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane tablePane = new JScrollPane(shipmentTable); tablePane.setPreferredSize(new Dimension(550, 250)); graphicPanel.add(tablePane); graphicPanel.add(pickupButton); } graphicPanel.validate(); graphicPanel.repaint(); }
private JComponent createSchemaBox() { schemaBox = new SchemaBox(this); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS)); panel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, ThemeMediator.LIGHT_BORDER_COLOR)); final String strShowOpts = I18n.tr("Show Options"); final String strHideOpts = I18n.tr("Hide Options"); // reusing schema box panel for more options button // minor optimization to keep the layout as flat as possible final JButton buttonOptions = new JButton(strShowOpts); buttonOptions.setContentAreaFilled(false); // buttonOptions.setBorderPainted(false); buttonOptions.setOpaque(false); Dimension dim = new Dimension(120, 30); buttonOptions.setMinimumSize(dim); buttonOptions.setMaximumSize(dim); buttonOptions.setPreferredSize(dim); buttonOptions.setSize(dim); // buttonOptions.setMargin(new Insets(0, 0, 0, 0)); // buttonOptions.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, // ThemeMediator.LIGHT_BORDER_COLOR)); buttonOptions.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { scrollPaneSearchOptions.setVisible(!scrollPaneSearchOptions.isVisible()); buttonOptions.setText(scrollPaneSearchOptions.isVisible() ? strHideOpts : strShowOpts); } }); JSeparator sep = new JSeparator(SwingConstants.VERTICAL); sep.setMaximumSize(new Dimension(2, 100)); panel.add(schemaBox); panel.add(Box.createHorizontalGlue()); panel.add(sep); panel.add(buttonOptions); return panel; }
private void jbInit() throws Exception { this.setResizable(false); this.setSize(new Dimension(460, 440)); this.getContentPane().setLayout(null); jScrollPane1.setBounds(new Rectangle(35, 135, 380, 160)); jLabel1.setText("Enter ID"); jLabel1.setBounds(new Rectangle(35, 35, 105, 20)); jCBselectStudent.setBounds(new Rectangle(175, 30, 230, 20)); jCBselectStudent.setFont(new Font("Times New Roman", 0, 12)); jLabel2.setText("Students List"); jLabel2.setBounds(new Rectangle(35, 110, 80, 15)); jCBselectCourse.setBounds(new Rectangle(175, 65, 230, 20)); jCBselectCourse.setFont(new Font("Times New Roman", 0, 12)); jCBselectCourse.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jCBselectCourse_actionPerformed(e); } }); jLabel4.setText("Select Course"); jLabel4.setBounds(new Rectangle(35, 65, 80, 20)); jSeparator1.setBounds(new Rectangle(0, 95, 465, 5)); jButton1.setText("Register"); jButton1.setBounds(new Rectangle(290, 335, 125, 35)); jButton1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); jButton2.setText("Back"); jButton2.setBounds(new Rectangle(35, 340, 125, 35)); jButton2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jButton2_actionPerformed(e); } }); fillComboBoxes(); this.getContentPane().add(jButton2, null); this.getContentPane().add(jButton1, null); this.getContentPane().add(jSeparator1, null); this.getContentPane().add(jLabel4, null); this.getContentPane().add(jCBselectCourse, null); this.getContentPane().add(jLabel2, null); this.getContentPane().add(jCBselectStudent, null); this.getContentPane().add(jLabel1, null); jScrollPane1.getViewport().add(jTAstudentList, null); this.getContentPane().add(jScrollPane1, null); jTAstudentList.setFont(new Font("Times New Roman", 0, 12)); this.setLocationRelativeTo(null); this.setVisible(true); }
/** * Builds the bottom panel displaying Ok and Cancel buttons. * * @return the bottom panel. */ private Component getBottomPanel() { JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10)); btnOk = new JButton("Ok"); btnOk.addActionListener(this); btnCancel = new JButton("Cancel"); btnCancel.addActionListener(this); buttonPanel.add(btnOk); buttonPanel.add(btnCancel); buttonPanel.setPreferredSize(new Dimension(WIDTH - 10, 40)); JPanel bottomPanel = new JPanel(); JSeparator separator = new JSeparator(JSeparator.HORIZONTAL); separator.setPreferredSize(new Dimension(WIDTH, 1)); bottomPanel.add(separator); bottomPanel.add(buttonPanel); bottomPanel.setPreferredSize(new Dimension(WIDTH - 10, 60)); return bottomPanel; }
public ExpressionTester() { setLayout(new BorderLayout()); _txtExpression = new JTextPane(new HighlightedDocument()); JScrollPane scpExp = new JScrollPane(_txtExpression); scpExp.setPreferredSize(new Dimension(400, 400)); _txtResult = new JTextArea(); _txtResult.setEditable(false); JScrollPane scpResutlt = new JScrollPane(_txtResult); scpResutlt.setPreferredSize(new Dimension(200, 400)); _btnEval = new JButton("Evaluate"); _btnEval.setPreferredSize(new Dimension(400, 20)); JSeparator sep = new JSeparator(); sep.setPreferredSize(new Dimension(10, 400)); sep.setMaximumSize(new Dimension(10, 400)); add(scpExp, BorderLayout.CENTER); add(scpResutlt, BorderLayout.LINE_END); add(_btnEval, BorderLayout.PAGE_END); _btnEval.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { _txtResult.setText(""); try { Valueable[] valueables = ExpressionFactory.evalExpression(_txtExpression.getText().toLowerCase()); StringBuilder buffer = new StringBuilder(); for (Valueable val : valueables) { buffer.append("[" + val.getValue("1") + "]\n"); } _txtResult.setText(buffer.toString()); } catch (Exception exc) { exc.printStackTrace(); _txtResult.setText("Can not evaluate"); } } }); }
/** Called if the user changes the selected items. */ public void updateSelection() { int layer = getSelectedLayer(); /* layer values: * -1 means nothing selected * -2 means different layers selected */ boolean justCreated = !(app.getActiveEuclidianView().getEuclidianController().getJustCreatedGeos().isEmpty()); copyAction.setEnabled(!app.getSelectedGeos().isEmpty()); pasteAction.setEnabled(!CopyPaste.isEmpty()); deleteAction.setEnabled(layer != -1 || justCreated); deleteItem.setVisible(layer != -1 || justCreated); deleteSeparator.setVisible(layer != -1 || justCreated); showhideAction.setEnabled(layer != -1); showhideItem.setVisible(layer != -1); showhideLabelsAction.setEnabled(layer != -1); showhideLabelsItem.setVisible(layer != -1); // exactly one layer selected selectCurrentLayerAction.setEnabled(getSelectedLayer() >= 0); selectCurrentLayerItem.setVisible(getSelectedLayer() >= 0); boolean haveSelection = !app.getSelectedGeos().isEmpty(); invertAction.setEnabled(haveSelection); invertItem.setVisible(haveSelection); selectAllDescendantsAction.setEnabled(haveSelection); selectAllDescendantsItem.setVisible(haveSelection); selectAllAncestorsAction.setEnabled(haveSelection); selectAllAncestorsItem.setVisible(haveSelection); selectionSeparator.setVisible(haveSelection); Kernel kernel = app.getKernel(); propertiesAction.setEnabled(!kernel.isEmpty()); selectAllAction.setEnabled(!kernel.isEmpty()); }
public void resetDetailPane() { detailPane.removeAll(); Dimension d = new Dimension(0, 3); detailPane.setOpaque(false); detPaneHolder.setOpaque(false); if (selectedContact != null && selectedContact.getProperties() != null) { String[][] properties = selectedContact.getProperties(); for (String[] property : properties) { javax.swing.JSeparator space = new JSeparator(SwingConstants.HORIZONTAL); space.setSize(d); detailPane.add(space); DetInnerPaneBlocks dipb = new DetInnerPaneBlocks(property[0], property[1]); detailPane.add(dipb); } detailPane.add(Box.createGlue()); detailPane.setSize(0, (DetInnerPaneBlocks.height + d.height) * properties.length); } else { detailPane.setSize(0, 0); } resetDetPaneHolderSize(); }
/** * @param menu * @param subTypes */ public void updatePopup(JMenu menu, int... subTypes) { MenuLogic.clearPluginMenus(menu); ShipSpec spec = StarMadeLogic.getInstance().getCurrentModel(); if (spec == null) { return; } int type = spec.getClassification(); int lastModIndex = menu.getItemCount(); int lastCount = 0; for (int subType : subTypes) { int thisCount = MenuLogic.addPlugins(getClient(), menu, type, subType); if ((thisCount > 0) && (lastCount > 0)) { JSeparator sep = new JSeparator(); sep.setName("plugin"); menu.add(sep, lastModIndex); lastCount = 0; } lastCount += thisCount; lastModIndex = menu.getItemCount(); } }
ToolBarTablePane(JToolBar toolBar, JTable table) { super(new BorderLayout()); setOpaque(false); JPanel t = new JPanel(new BorderLayout()); t.setOpaque(false); toolBar.setOpaque(false); t.add(toolBar, BorderLayout.NORTH); JSeparator sep = new JSeparator(JSeparator.HORIZONTAL); sep.setOpaque(false); sep.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0)); t.add(sep, BorderLayout.CENTER); JScrollPane scroller = new JScrollPane(table) { public Dimension getPreferredSize() { return new Dimension(super.getPreferredSize().width, 240); } }; ; scroller.setOpaque(false); scroller.setBorder(BorderFactory.createLineBorder(UIManager.getColor("Label.foreground"))); add(t, BorderLayout.NORTH); add(scroller, BorderLayout.CENTER); }
public TextPanel() { this.setSize(750, 80); this.setPreferredSize(this.getSize()); setLayout(null); lblFile = new JLabel(Messages.getString("guiFile")); lblFile.setBounds(31, 11, 64, 19); lblFile.setFont(new Font("Tahoma", Font.BOLD, 15)); add(lblFile); btnBrowse = new JButton(Messages.getString("guiBrowse")); btnBrowse.setBounds(476, 38, 100, 23); add(btnBrowse); lblTextPath = new JLabel(Messages.getString("guiFilePath")); lblTextPath.setBounds(31, 42, 64, 14); add(lblTextPath); tfTextPath = new JTextField(); tfTextPath.setEditable(false); tfTextPath.setBounds(100, 38, 372, 23); add(tfTextPath); tfTextPath.setColumns(10); JSeparator separator = new JSeparator(); separator.setBounds(195, 78, 359, 1); add(separator); btnPreview = new JButton(Messages.getString("guiPreview")); btnPreview.setBounds(604, 38, 100, 23); btnPreview.setEnabled(false); add(btnPreview); loadFileDialog = new EducryptFileChooser(this); loadFileDialog.setTextMode(); }
@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { int labelX = x + outsideInsets.left; int labelY = y + outsideInsets.top; TitledSeparator titledSeparator = getTitledSeparator(c); JLabel label = titledSeparator.getLabel(); Dimension labelSize = label.getPreferredSize(); label.setSize(labelSize); g.translate(labelX, labelY); label.paint(g); int separatorX = labelX + labelSize.width + TitledSeparator.SEPARATOR_LEFT_INSET; int separatorY = labelY + (UIUtil.isUnderAquaLookAndFeel() ? 2 : labelSize.height / 2 - 1); int separatorW = Math.max(0, width - separatorX - TitledSeparator.SEPARATOR_RIGHT_INSET); int separatorH = 2; JSeparator separator = titledSeparator.getSeparator(); separator.setSize(separatorW, separatorH); g.translate(separatorX - labelX, separatorY - labelY); separator.paint(g); g.translate(-separatorX, -separatorY); }
/* WARNING: THIS METHOD WILL BE REGENERATED. */ private javax.swing.JSeparator getJSeparator2() { if (ivjJSeparator2 == null) { try { ivjJSeparator2 = new javax.swing.JSeparator(); ivjJSeparator2.setName("JSeparator2"); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjJSeparator2; }
public void show(Component invoker, int x, int y) { ViperViewMediator mediator = getMediator(); Point pnt = new Point(x, y); EnhancedTable tab = getTable(); int row = tab.rowAtPoint(pnt); desc = getCurrentModel().getDescriptorAtRow(row); int col = tab.columnAtPoint(pnt); Object cellValue = tab.getValueAt(row, col); if (cellValue instanceof Attribute) { attr = (Attribute) cellValue; // hide the "Occlusions..." option when we're not dealing with a Textline object boolean isTextline = attr.getAttrConfig().getAttrType().endsWith("textline"); occlusions.setVisible(isTextline); occSeparator.setVisible(isTextline); Instant now = mediator.getCurrentFrame(); if (now == null) { mediator.getDisplayWRTManager().setAttribute(null, null); wrt.setEnabled(false); wrt.setSelected(false); } else { boolean isDwrt = attr == mediator.getDisplayWRTManager().getAttribute(); boolean dwrtable = (attr.getAttrValueAtInstant(now) instanceof HasCentroid && attr.getDescriptor().getValidRange().contains(now)); wrt.setEnabled(dwrtable); wrt.setSelected(isDwrt); } } else { attr = null; wrt.setEnabled(false); wrt.setSelected(false); } if (null != desc) { PropagateInterpolateModule proper = getMediator().getPropagator(); p.setSelected(proper.isPropagatingThis(desc)); v.setSelected(mediator.isThisValidNow(desc)); resetMarks(); super.show(invoker, x, y); } }
public void buildGUI() { // Initializes frame JFrame frame = new JFrame("Team 610 Scouting Application"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(1200, 900)); frame.setResizable(false); frame.setLayout(null); // Initialize components buttonPanel = new ButtonPanel(this); paintPanel = new PaintPanel(this); statusPanel = new StatusPanel(this); scoutForm = new ScoutForm(this); JSeparator vertSeparator = new JSeparator(SwingConstants.VERTICAL); JSeparator horizSeparator = new JSeparator(SwingConstants.HORIZONTAL); JSeparator horizSeparatorB = new JSeparator(SwingConstants.HORIZONTAL); // Set component positions buttonPanel.setBounds(0, 650, 745, 200); paintPanel.setBounds(0, 0, 745, 324); statusPanel.setBounds(0, 328, 745, 320); scoutForm.setBounds(747, 0, 420, 900); vertSeparator.setBounds(745, 0, 2, 900); horizSeparator.setBounds(0, 325, 745, 2); horizSeparatorB.setBounds(0, 648, 745, 2); // Additional setup paintPanel.setBackgroundImage(); paintPanel.requestFocusInWindow(); // Adds components to the frame frame.getContentPane().add(buttonPanel); frame.getContentPane().add(paintPanel); frame.getContentPane().add(statusPanel); frame.getContentPane().add(scoutForm); frame.getContentPane().add(vertSeparator); frame.getContentPane().add(horizSeparator); frame.getContentPane().add(horizSeparatorB); // Pack frame frame.pack(); // Make frame visible frame.setVisible(true); }