private JPanel createDynamicCenterPanel(PrimitiveForm primitiveForm, DOTProperty property) { final JTable theTable = new JTable(); PrimitiveFormPropertyPair pfpPair = new PrimitiveFormPropertyPair(primitiveForm.getName(), property); _dynamicTables.put(pfpPair, theTable); DOTPoint dotPoint = (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType(); final DynamicDOTItemManager tableModel = (DynamicDOTItemManager) dotPoint.getTableModel(primitiveForm, property); theTable.setModel(tableModel); class NumberComparator implements Comparator<Number> { public int compare(Number o1, Number o2) { final double d1 = o1.doubleValue(); final double d2 = o2.doubleValue(); if (d1 < d2) { return -1; } if (d1 == d2) { return 0; } return 1; } } TableRowSorter<DynamicDOTItemManager> tableRowSorter = new TableRowSorter<DynamicDOTItemManager>(); tableRowSorter.setModel(tableModel); tableRowSorter.setComparator(4, new NumberComparator()); tableRowSorter.setComparator(5, new NumberComparator()); theTable.setRowSorter(tableRowSorter); JButton newDOTItemButton = new JButton("Neue Zeile"); newDOTItemButton.setEnabled(_dotDefinitionDialogFrame.isEditable()); JButton deleteDOTItemButton = new JButton("Zeile löschen"); deleteDOTItemButton.setEnabled(false); JButton showConflictsButton = new JButton("Zeige Konflikte"); addButtonListeners( primitiveForm, property, newDOTItemButton, deleteDOTItemButton, showConflictsButton); addListSelectionListener(theTable, deleteDOTItemButton); JPanel dotButtonsPanel = new JPanel(); dotButtonsPanel.setLayout(new SpringLayout()); dotButtonsPanel.add(newDOTItemButton); dotButtonsPanel.add(deleteDOTItemButton); dotButtonsPanel.add(showConflictsButton); dotButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); SpringUtilities.makeCompactGrid(dotButtonsPanel, 1, 5, 20); JPanel thePanel = new JPanel(); thePanel.setLayout(new SpringLayout()); thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK)); thePanel.add(new JScrollPane(theTable)); thePanel.add(dotButtonsPanel); SpringUtilities.makeCompactGrid(thePanel, 2, 20, 5); return thePanel; }
/** * Build the UI of the given process according to the given data. * * @param processExecutionData Process data. * @return The UI for the configuration of the process. */ public JComponent buildUIConf(ProcessExecutionData processExecutionData) { JPanel panel = new JPanel(new MigLayout("fill")); // For each input, display its title, its abstract and gets its UI from the dataUIManager for (Input i : processExecutionData.getProcess().getInput()) { JPanel inputPanel = new JPanel(new MigLayout("fill")); inputPanel.setBorder(BorderFactory.createTitledBorder(i.getTitle())); JLabel inputAbstrac = new JLabel(i.getResume()); inputAbstrac.setFont(inputAbstrac.getFont().deriveFont(Font.ITALIC)); inputPanel.add(inputAbstrac, "wrap"); DataUI dataUI = dataUIManager.getDataUI(i.getDataDescription().getClass()); if (dataUI != null) { inputPanel.add(dataUI.createUI(i, processExecutionData.getInputDataMap()), "wrap"); } panel.add(inputPanel, "growx, wrap"); } // For each output, display its title, its abstract and gets its UI from the dataUIManager for (Output o : processExecutionData.getProcess().getOutput()) { DataUI dataUI = dataUIManager.getDataUI(o.getDataDescription().getClass()); if (dataUI != null) { JComponent component = dataUI.createUI(o, processExecutionData.getOutputDataMap()); if (component != null) { JPanel outputPanel = new JPanel(new MigLayout("fill")); outputPanel.setBorder(BorderFactory.createTitledBorder(o.getTitle())); JLabel outputAbstrac = new JLabel(o.getResume()); outputAbstrac.setFont(outputAbstrac.getFont().deriveFont(Font.ITALIC)); outputPanel.add(outputAbstrac, "wrap"); outputPanel.add(component, "wrap"); panel.add(outputPanel, "growx, wrap"); } } } return panel; }
private void initComponents() { jfxPanel = new JFXPanel(); createScene(); ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { loadURL(txtURL.getText()); } }; btnGo.addActionListener(al); txtURL.addActionListener(al); progressBar.setPreferredSize(new Dimension(150, 18)); progressBar.setStringPainted(true); JPanel topBar = new JPanel(new BorderLayout(5, 0)); topBar.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); topBar.add(txtURL, BorderLayout.CENTER); topBar.add(btnGo, BorderLayout.EAST); JPanel statusBar = new JPanel(new BorderLayout(5, 0)); statusBar.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); statusBar.add(lblStatus, BorderLayout.CENTER); statusBar.add(progressBar, BorderLayout.EAST); panel.add(topBar, BorderLayout.NORTH); panel.add(jfxPanel, BorderLayout.CENTER); panel.add(statusBar, BorderLayout.SOUTH); frame.getContentPane().add(panel); }
/** Show the filter dialog */ public void showDialog() { empty_border = new EmptyBorder(5, 5, 0, 5); indent_border = new EmptyBorder(5, 25, 5, 5); include_panel = new ServiceFilterPanel("Include messages based on target service:", filter_include_list); exclude_panel = new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list); status_box = new JCheckBox("Filter messages based on status:"); status_box.addActionListener(this); status_active = new JRadioButton("Active messages only"); status_active.setSelected(true); status_active.setEnabled(false); status_complete = new JRadioButton("Complete messages only"); status_complete.setEnabled(false); status_group = new ButtonGroup(); status_group.add(status_active); status_group.add(status_complete); if (filter_active || filter_complete) { status_box.setSelected(true); status_active.setEnabled(true); status_complete.setEnabled(true); if (filter_complete) { status_complete.setSelected(true); } } status_options = new JPanel(); status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS)); status_options.add(status_active); status_options.add(status_complete); status_options.setBorder(indent_border); status_panel = new JPanel(); status_panel.setLayout(new BorderLayout()); status_panel.add(status_box, BorderLayout.NORTH); status_panel.add(status_options, BorderLayout.CENTER); status_panel.setBorder(empty_border); ok_button = new JButton("Ok"); ok_button.addActionListener(this); cancel_button = new JButton("Cancel"); cancel_button.addActionListener(this); buttons = new JPanel(); buttons.setLayout(new FlowLayout()); buttons.add(ok_button); buttons.add(cancel_button); panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(include_panel); panel.add(exclude_panel); panel.add(status_panel); panel.add(buttons); dialog = new JDialog(); dialog.setTitle("SOAP Monitor Filter"); dialog.setContentPane(panel); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setModal(true); dialog.pack(); Dimension d = dialog.getToolkit().getScreenSize(); dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2); ok_pressed = false; dialog.show(); }
public PatternBackgroundQuickPane() { this.setLayout(new BorderLayout(0, 4)); JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); this.add(contentPane, BorderLayout.NORTH); contentPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); JPanel typePane2 = new JPanel(); contentPane.add(typePane2); typePane2.setLayout(new GridLayout(0, 8, 1, 1)); typePane2.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); ButtonGroup patternButtonGroup = new ButtonGroup(); patternButtonArray = new PatternButton[PatternBackground.PATTERN_COUNT]; for (int i = 0; i < PatternBackground.PATTERN_COUNT; i++) { patternButtonArray[i] = new PatternButton(i); patternButtonGroup.add(patternButtonArray[i]); typePane2.add(patternButtonArray[i]); } JPanel colorPane = new JPanel(new GridLayout(0, 2)); foregroundColorPane = new ColorSelectBox(70); backgroundColorPane = new ColorSelectBox(70); foregroundColorPane.setSelectObject(Color.lightGray); backgroundColorPane.setSelectObject(Color.black); colorPane.add( this.createLabelColorPane(Inter.getLocText("Foreground") + ":", foregroundColorPane)); colorPane.add( this.createLabelColorPane(Inter.getLocText("Background") + ":", backgroundColorPane)); this.add(colorPane, BorderLayout.CENTER); foregroundColorPane.addSelectChangeListener(colorChangeListener); backgroundColorPane.addSelectChangeListener(colorChangeListener); }
public AboutDialog(View view) { super(view, jEdit.getProperty("about.title"), true); JPanel content = new JPanel(new BorderLayout()); content.setBorder(new EmptyBorder(12, 12, 12, 12)); setContentPane(content); content.add(BorderLayout.CENTER, new AboutPanel()); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.setBorder(new EmptyBorder(12, 0, 0, 0)); buttonPanel.add(Box.createGlue()); close = new JButton(jEdit.getProperty("common.close")); close.addActionListener(new ActionHandler()); getRootPane().setDefaultButton(close); buttonPanel.add(close); buttonPanel.add(Box.createGlue()); content.add(BorderLayout.SOUTH, buttonPanel); pack(); setResizable(false); setLocationRelativeTo(view); show(); }
public UserPasswordDialog(String title) { super(new JFrame(), title); getContentPane().setLayout(new BorderLayout()); JPanel userPanel = new JPanel(); userPanel.setLayout(new BorderLayout()); userPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); userPanel.add("West", userLabel); userPanel.add("Center", userField); JPanel passwordPanel = new JPanel(); passwordPanel.setLayout(new BorderLayout()); passwordPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); passwordPanel.add("West", passwordLabel); passwordPanel.add("Center", passwordField); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BorderLayout()); buttonPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); buttonPanel.add("West", okButton); buttonPanel.add("East", cancelButton); okButton.addActionListener(this); cancelButton.addActionListener(this); getContentPane().add("North", userPanel); getContentPane().add("Center", passwordPanel); getContentPane().add("South", buttonPanel); pack(); }
/** * 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); }
/** * Renvoit le JPanel à afficher, avec en paramètre un booléen indiquant s'il s'agit du dernier * élément à afficher dans une liste d'enfants (auquel cas un bouton + peut être affiché) */ private JPanel getPanel(final boolean dernier) { panelEnfants = new JPanel(new GridBagLayout()); panelElement = new JPanel(new BorderLayout()); if (!attribut && affParent != null && affParent.enfantsMultiples(refNoeud)) { final JPanel panelBoutons = new JPanel(new BorderLayout()); if (dernier) { final JButton boutonPlus = new JButton("+"); boutonPlus.setAction( new AbstractAction("+") { public void actionPerformed(final ActionEvent e) { affParent.ajouterAffichageEnfant(AffichageFormulaire.this); } }); panelBoutons.add(boutonPlus, BorderLayout.WEST); } final JButton boutonMoins = new JButton("-"); boutonMoins.setAction( new AbstractAction("-") { public void actionPerformed(final ActionEvent e) { affParent.retirerAffichageEnfant(AffichageFormulaire.this); } }); panelBoutons.add(boutonMoins, BorderLayout.EAST); panelElement.add(panelBoutons, BorderLayout.EAST); panelElement.add(panelEnfants, BorderLayout.CENTER); } else panelElement.add(panelEnfants, BorderLayout.CENTER); if (affParent != null) { panelElement.add(getPanelTitre(), BorderLayout.NORTH); panelEnfants.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5))); panelElement.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); } majPanel(null); if (affParent == null) { panelEnfants.setFocusCycleRoot(true); panelElement = new JPanel(new BorderLayout()) { @Override public Dimension getMaximumSize() { if (System.getProperty("os.name") .startsWith("Mac OS")) { // curseur pas visible à droite sur la JVM d'Apple avec // getMaximumSize() final Dimension tps = doc.textPane.getSize(); final JaxeElement je = doc.getElementForNode(noeud); return (new Dimension(tps.width - 20 * (je.indentations() + 1) - 2, tps.height)); } return (super.getMaximumSize()); } }; panelElement.setOpaque(false); panelElement.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); panelEnfants.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(getTitre()), BorderFactory.createEmptyBorder(5, 5, 5, 5))); panelElement.add(panelEnfants, BorderLayout.CENTER); } return (panelElement); }
protected void initComponents() { int border = 2; this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); // Description label JPanel descriptionPanel = new JPanel(new GridLayout(0, 1, 0, 0)); descriptionPanel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border)); String text = thread.getRetrievable().getName(); text = text.length() > 40 ? text.substring(0, 37) + "..." : text; descriptionLabel = new JLabel(text); descriptionPanel.add(descriptionLabel); this.add(descriptionPanel); // Progrees and cancel button JPanel progressPanel = new JPanel(); progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.X_AXIS)); progressPanel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border)); progressBar = new JProgressBar(0, 100); progressBar.setPreferredSize(new Dimension(100, 16)); progressPanel.add(progressBar); progressPanel.add(Box.createHorizontalStrut(8)); cancelButton = new JButton("Cancel"); cancelButton.setBackground(Color.RED); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { cancelButtonActionPerformed(event); } }); progressPanel.add(cancelButton); this.add(progressPanel); }
public CreInvChecker(Component parent) { typeButtons = new JCheckBox[CHECKTYPES.length]; JPanel boxPanel = new JPanel(new GridLayout(0, 1)); for (int i = 0; i < typeButtons.length; i++) { typeButtons[i] = new JCheckBox(CHECKTYPES[i], true); boxPanel.add(typeButtons[i]); } bstart.setMnemonic('s'); bcancel.setMnemonic('c'); bstart.addActionListener(this); bcancel.addActionListener(this); selectframe.getRootPane().setDefaultButton(bstart); selectframe.setIconImage(Icons.getIcon("Find16.gif").getImage()); boxPanel.setBorder(BorderFactory.createTitledBorder("Select test to check:")); JPanel bpanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); bpanel.add(bstart); bpanel.add(bcancel); JPanel mainpanel = new JPanel(new BorderLayout()); mainpanel.add(boxPanel, BorderLayout.CENTER); mainpanel.add(bpanel, BorderLayout.SOUTH); mainpanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); JPanel pane = (JPanel) selectframe.getContentPane(); pane.setLayout(new BorderLayout()); pane.add(mainpanel, BorderLayout.CENTER); selectframe.pack(); Center.center(selectframe, parent.getBounds()); selectframe.setVisible(true); }
public CopyFileToTable() { JPanel jPane1 = new JPanel(); jPane1.setLayout(new BorderLayout()); jPane1.add(new JLabel("Filename"), BorderLayout.WEST); jPane1.add(jbtViewFile, BorderLayout.EAST); jPane1.add(jtfFilename, BorderLayout.CENTER); JPanel jPane2 = new JPanel(); jPane2.setLayout(new BorderLayout()); jPane2.setBorder(new TitledBorder("Source Text File")); jPane2.add(jPane1, BorderLayout.NORTH); jPane2.add(new JScrollPane(jtaFile), BorderLayout.CENTER); JPanel jPane3 = new JPanel(); jPane3.setLayout(new GridLayout(5, 0)); jPane3.add(new JLabel("JDBC Driver")); jPane3.add(new JLabel("Database URL")); jPane3.add(new JLabel("Username")); jPane3.add(new JLabel("Password")); jPane3.add(new JLabel("Table Name")); JPanel jPane4 = new JPanel(); jPane4.setLayout(new GridLayout(5, 0)); jcboDriver.setEditable(true); jPane4.add(jcboDriver); jcboURL.setEditable(true); jPane4.add(jcboURL); jPane4.add(jtfUsername); jPane4.add(jtfPassword); jPane4.add(jtfTableName); JPanel jPane5 = new JPanel(); jPane5.setLayout(new BorderLayout()); jPane5.setBorder(new TitledBorder("Target Database Table")); jPane5.add(jbtCopy, BorderLayout.SOUTH); jPane5.add(jPane3, BorderLayout.WEST); jPane5.add(jPane4, BorderLayout.CENTER); add(jlblStatus, BorderLayout.SOUTH); add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jPane2, jPane5), BorderLayout.CENTER); jbtViewFile.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { showFile(); } }); jbtCopy.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { try { copyFile(); } catch (Exception ex) { jlblStatus.setText(ex.toString()); } } }); }
public AddNewStudent() // constructor { // initializing buttons btnok = new JButton("OK"); btnok.addActionListener(this); btnexit = new JButton("Exit"); btnexit.addActionListener(this); btnaddnew = new JButton("AddNew"); btnaddnew.addActionListener(this); // initializing textfields tf1 = new JTextField(12); tf2 = new JTextField(12); // initializing labels lblname = new JLabel("Name:"); lbladd = new JLabel("Address:"); lblmsg = new JLabel("", JLabel.CENTER); // initializing panels p1 = new JPanel(); p2 = new JPanel(); p3 = new JPanel(); psouth = new JPanel(); // adding buttons and label to panel p1 // setting flowlayout p1.setLayout(new FlowLayout()); p1.add(btnok); p1.add(btnexit); p1.add(btnaddnew); // adding lblmsg to panel p3 p3.add(lblmsg); // adding both the panels to new panel,psouth // settin layout 2:1 psouth.setLayout(new GridLayout(2, 1)); psouth.add(p3); psouth.add(p1); // adding label and textfields to panel p2 p2.setLayout(new GridLayout(3, 1)); // setting line and titled border for panel p2 p2.setBorder(BorderFactory.createLineBorder(Color.red)); p2.setBorder(BorderFactory.createTitledBorder("Enter Your Details")); p2.add(lblname); p2.add(tf1); p2.add(lbladd); p2.add(tf2); // adding panel to container this.getContentPane().add(p2, "Center"); this.getContentPane().add(psouth, "South"); this.setSize(300, 300); this.setLocation(100, 200); this.show(); }
public void setOrientation(int o) { orientation = o; panel.setLayout(new BoxLayout(panel, orientation)); if (isHorisontal()) { panel.setBorder(BorderFactory.createEmptyBorder(9, 0, 0, 0)); } else { panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); } }
/** * Build the UI of the given process according to the given data. * * @param processExecutionData Process data. * @return The UI for the configuration of the process. */ public JComponent buildUIInfo(ProcessExecutionData processExecutionData) { JPanel panel = new JPanel(new MigLayout("fill")); Process p = processExecutionData.getProcess(); // Process info JLabel titleContentLabel = new JLabel(p.getTitle()); JLabel abstracContentLabel = new JLabel(); if (p.getResume() != null) { abstracContentLabel.setText(p.getResume()); } else { abstracContentLabel.setText("-"); abstracContentLabel.setFont(abstracContentLabel.getFont().deriveFont(Font.ITALIC)); } JPanel processPanel = new JPanel(new MigLayout()); processPanel.setBorder(BorderFactory.createTitledBorder("Process :")); processPanel.add(titleContentLabel, "wrap, align left"); processPanel.add(abstracContentLabel, "wrap, align left"); // Input info JPanel inputPanel = new JPanel(new MigLayout()); inputPanel.setBorder(BorderFactory.createTitledBorder("Inputs :")); for (Input i : p.getInput()) { inputPanel.add(new JLabel(dataUIManager.getIconFromData(i))); inputPanel.add(new JLabel(i.getTitle()), "align left, wrap"); if (i.getResume() != null) { JLabel abstrac = new JLabel(i.getResume()); abstrac.setFont(abstrac.getFont().deriveFont(Font.ITALIC)); inputPanel.add(abstrac, "span 2, wrap"); } else { inputPanel.add(new JLabel("-"), "span 2, wrap"); } } // Output info JPanel outputPanel = new JPanel(new MigLayout()); outputPanel.setBorder(BorderFactory.createTitledBorder("Outputs :")); for (Output o : p.getOutput()) { outputPanel.add(new JLabel(dataUIManager.getIconFromData(o))); outputPanel.add(new JLabel(o.getTitle()), "align left, wrap"); if (o.getResume() != null) { JLabel abstrac = new JLabel(o.getResume()); abstrac.setFont(abstrac.getFont().deriveFont(Font.ITALIC)); outputPanel.add(abstrac, "span 2, wrap"); } else { outputPanel.add(new JLabel("-"), "align center, span 2, wrap"); } } panel.add(processPanel, "growx, wrap"); panel.add(inputPanel, "growx, wrap"); panel.add(outputPanel, "growx, wrap"); return panel; }
public void kosmetika() { setTitle("Knygų sąrašų demo - KTU IF 2012"); panKnygųSar.setBorder(new TitledBorder("Visų knygų ir atrinktų knygų sąrašai")); panKnygųSar.setBackground(Color.lightGray); panDuomenys.setBorder(new TitledBorder("Knygų duomenys")); panDuomenys.setBackground(Color.lightGray); panAsmensDuo.setBackground(Color.white); panRez.setBackground(Color.white); panMygt.setBackground(Color.white); }
public void kosmetika() { setTitle("Automobilių sąrašų demo - KTU IF 2010"); panAutoSąr.setBorder(new TitledBorder("Visų automobilių ir atrinktų automobilių sąrašai")); panAutoSąr.setBackground(Color.yellow); panDuomenys.setBorder(new TitledBorder("Automobilių duomenys")); panDuomenys.setBackground(Color.lightGray); panAsmensDuo.setBackground(Color.green); panRez.setBackground(Color.gray); panMygt.setBackground(Color.magenta); }
public AppFrame() { // Create the WorldWindow. this.wwjPanel = new ApplicationTemplate.AppPanel(this.canvasSize, true); this.wwjPanel.setPreferredSize(canvasSize); ApplicationTemplate.insertBeforePlacenames(this.wwjPanel.getWwd(), layer); JPanel shapesPanel = makeShapeSelectionPanel(); shapesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel attrsPanel = makeAttributesPanel(); attrsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // Put the pieces together. JPanel controlPanel = new JPanel(new BorderLayout()); controlPanel.add(shapesPanel, BorderLayout.CENTER); JPanel p = new JPanel(new BorderLayout(6, 6)); p.add(attrsPanel, BorderLayout.CENTER); controlPanel.add(p, BorderLayout.SOUTH); this.getContentPane().add(wwjPanel, BorderLayout.CENTER); this.getContentPane().add(controlPanel, BorderLayout.WEST); this.pack(); // Center the application on the screen. Dimension prefSize = this.getPreferredSize(); Dimension parentSize; java.awt.Point parentLocation = new java.awt.Point(0, 0); parentSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = parentLocation.x + (parentSize.width - prefSize.width) / 2; int y = parentLocation.y + (parentSize.height - prefSize.height) / 2; this.setLocation(x, y); this.setResizable(true); wwjPanel .getWwd() .addRenderingListener( new RenderingListener() { public void stageChanged(RenderingEvent event) { if (!event.getStage().equals(RenderingEvent.BEFORE_BUFFER_SWAP)) return; if (currentShape instanceof Polyline) { Polyline p = (Polyline) currentShape; String length = Double.toString(p.getLength()); textRenderer.beginRendering(wwjPanel.getWidth(), wwjPanel.getHeight()); textRenderer.draw(length, 100, 100); textRenderer.endRendering(); } } }); // Enable dragging and other selection responses this.setupSelection(); }
// {{{ createCenterPanel() method public JPanel createCenterPanel() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm"); JPanel centerPanel = new JPanel(new BorderLayout()); JPanel propField = new JPanel(); propField.setLayout(new GridLayout(4, 1)); propField.add(new JLabel(jEdit.getProperty("fileprop.name") + ": " + local.getName())); propField.add(new JLabel(jEdit.getProperty("fileprop.path") + ": " + local.getPath())); // Show last modified property only for LocalFile if (local instanceof LocalFile) { propField.add( new JLabel( jEdit.getProperty("fileprop.lastmod") + ": " + sdf.format(new Date(((LocalFile) local).getModified())))); } if (local.getType() == VFSFile.DIRECTORY) { File ioFile = new File(local.getPath()); propField.add( new JLabel( jEdit.getProperty("fileprop.size") + ": " + StandardUtilities.formatFileSize(IOUtilities.fileLength(ioFile)))); } else { propField.add( new JLabel( jEdit.getProperty("fileprop.size") + ": " + StandardUtilities.formatFileSize(local.getLength()))); } Border etch = BorderFactory.createEtchedBorder(); propField.setBorder( BorderFactory.createTitledBorder(etch, jEdit.getProperty("fileprop.properties"))); centerPanel.add(BorderLayout.CENTER, propField); JPanel attributeField = new JPanel(); attributeField.setLayout(new GridLayout(1, 2)); readable = new JCheckBox(jEdit.getProperty("fileprop.readable")); readable.setSelected(local.isReadable()); readable.setEnabled(false); attributeField.add(readable); write = new JCheckBox(jEdit.getProperty("fileprop.writeable")); write.setSelected(local.isWriteable()); write.setEnabled(false); attributeField.add(write); attributeField.setBorder( BorderFactory.createTitledBorder(etch, jEdit.getProperty("fileprop.attribute"))); centerPanel.add(BorderLayout.SOUTH, attributeField); return centerPanel; } // }}}
public DetectiveNotes(ArrayList<Card> cards) { // Sets the standard window information this.setLayout(new GridLayout(0, 2)); setTitle("Detective Notes"); setSize(600, 700); // Initialize the lists playerList = new ArrayList<String>(); weaponList = new ArrayList<String>(); roomList = new ArrayList<String>(); // Adds an "unsure" option to each list playerList.add("Unsure"); weaponList.add("Unsure"); roomList.add("Unsure"); // Reads the card names out of the file, storing it in the appropriate list for (Card card : cards) { if (card.getCardType() == CardType.PERSON) playerList.add(card.getName()); else if (card.getCardType() == CardType.WEAPON) weaponList.add(card.getName()); else if (card.getCardType() == CardType.ROOM) roomList.add(card.getName()); } // Sets up the selection boxes for the people, weapons, and rooms JPanel people = new JPanel(); people.setBorder(new TitledBorder(new EtchedBorder(), "People")); JComboBox PeopleCombo = new JComboBox(playerList.toArray()); PeopleCombo.setBorder(new TitledBorder(new EtchedBorder(), "People Guess")); JPanel weapons = new JPanel(); weapons.setBorder(new TitledBorder(new EtchedBorder(), "Weapons")); JComboBox WeaponsCombo = new JComboBox(weaponList.toArray()); WeaponsCombo.setBorder(new TitledBorder(new EtchedBorder(), "Weapons Guess")); JPanel rooms = new JPanel(); rooms.setBorder(new TitledBorder(new EtchedBorder(), "Rooms")); JComboBox RoomsCombo = new JComboBox(roomList.toArray()); RoomsCombo.setBorder(new TitledBorder(new EtchedBorder(), "Rooms Guess")); // Adds the player information to the JFrame addPlayerCheckboxes(people); add(people); add(PeopleCombo); // Adds the weapon information to the JFrame addWeaponCheckboxes(weapons); add(weapons); add(WeaponsCombo); // Adds the room information to the JFrame addRoomCheckboxes(rooms); add(rooms); add(RoomsCombo); }
private void kosmetika() { setTitle("Automobilių Queue ir Map struktūrų demo - KTU IF 2010"); panAutoSąr.setBorder( new TitledBorder( "Neregistruotų automobilių eilė ir " + "registruotų automobilių Map struktūra")); panAutoSąr.setBackground(Color.yellow); panDuomenys.setBorder(new TitledBorder("Registracijos duomenys ir veiksmai")); panDuomenys.setBackground(Color.lightGray); panRegNumeris.setBackground(Color.green); panRez.setBackground(Color.gray); panMygt.setBackground(Color.magenta); }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); LookAndFeelFactory.installJideExtension(); } catch (ClassNotFoundException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (UnsupportedLookAndFeelException e) { } _frame = new JideButtonDemo("Demo of JideButton"); _frame.setIconImage(JideIconsFactory.getImageIcon(JideIconsFactory.JIDE32).getImage()); _frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(new GridLayout(6, 1)); _buttons = new JideButton[6]; _buttons[0] = createHyperlinkButton( "Rename this file", ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.RENAME)); _buttons[1] = createHyperlinkButton( "Move this file", ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.MOVE)); _buttons[2] = createHyperlinkButton( "Copy this file", ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.COPY)); _buttons[3] = createHyperlinkButton( "Publish this file", ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.PUBLISH)); _buttons[4] = createHyperlinkButton( "Email this file", ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.EMAIL)); _buttons[5] = createHyperlinkButton( "Delete this file", ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.DELET)); for (int i = 0; i < _buttons.length; i++) { JideButton button = _buttons[i]; panel.add(button); } panel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12)); _frame.getContentPane().setLayout(new BorderLayout()); _frame.getContentPane().add(createOptionsPanel(), BorderLayout.AFTER_LINE_ENDS); JPanel topPanel = JideSwingUtilities.createTopPanel(panel); topPanel.setBorder(BorderFactory.createLoweredBevelBorder()); _frame.getContentPane().add(topPanel, BorderLayout.CENTER); _frame.setBounds(10, 10, 300, 500); _frame.setVisible(true); }
@Nullable @Override protected JComponent createCenterPanel() { final JPanel content = new JPanel(new BorderLayout()); final JPanel topLine = new JPanel(new BorderLayout()); content.setBorder( IdeBorderFactory.createTitledBorder( "Thrift compiler " + myGenerator.getType().name(), false)); myOutputFolderChooser.addBrowseFolderListener( new TextBrowseFolderListener( FileChooserDescriptorFactory.createSingleFolderDescriptor(), myProject) { @Nullable @Override protected VirtualFile getInitialFile() { if (myGenerator.getOutputDir() != null) { return LocalFileFinder.findFile(myGenerator.getOutputDir()); } else { return null; } } @Override protected void onFileChosen(@NotNull VirtualFile chosenFile) { final String absolutePath = VfsUtil.virtualToIoFile(chosenFile).getAbsolutePath(); myOutputFolderChooser.setText(absolutePath); } }); topLine.add(new JBLabel("Output folder:"), BorderLayout.WEST); topLine.add(myOutputFolderChooser, BorderLayout.CENTER); content.add(topLine, BorderLayout.NORTH); final JPanel options = new JPanel(new BorderLayout()); content.add(options, BorderLayout.CENTER); myPane = AOptionPane.get(myGenerator.getType()); if (myPane != null) { options.setBorder(IdeBorderFactory.createTitledBorder("Additional options")); options.add(myPane.getPanel()); myPane.setValues(myGenerator); } else { options.setBorder(null); } final String url = myGenerator.getOutputDir(); final VirtualFile file = url == null ? null : VirtualFileManager.getInstance().findFileByUrl(url); myOutputFolderChooser.setText(file == null ? VfsUtil.urlToPath(url) : file.getPath()); return content; }
public MainFrame() { try { mainPanel.setLayout(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9)); mainPanel.add(outputContainer, java.awt.BorderLayout.CENTER); outputArea.setLineWrap(true); outputContainer.add(new JScrollPane(outputArea), java.awt.BorderLayout.CENTER); outputContainer.setBorder(new javax.swing.border.TitledBorder("Results")); this.getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER); java.util.ArrayList<JButton> btns = new java.util.ArrayList<JButton>(); { JPanel westPanel = new JPanel(new GridLayout(0, 1, 0, 10)); westPanel.setBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9)); JPanel opsPanel = new JPanel(new GridLayout(6, 1)); opsPanel.setBorder(new javax.swing.border.TitledBorder("Operations")); for (Action action : operations) { JPanel p = new JPanel(new BorderLayout()); JButton jb = new JButton(action); btns.add(jb); p.add(jb, BorderLayout.NORTH); opsPanel.add(p); } westPanel.add(opsPanel); controlContainer.add(westPanel, BorderLayout.CENTER); } this.getContentPane().add(controlContainer, BorderLayout.WEST); this.pack(); Dimension dim = btns.get(0).getSize(); for (JButton btn : btns) { btn.setPreferredSize(dim); } java.awt.Dimension prefSize = this.getPreferredSize(); prefSize.setSize(prefSize.getWidth(), 1.1 * prefSize.getHeight()); this.setSize(prefSize); java.awt.Dimension parentSize; java.awt.Point parentLocation = new java.awt.Point(0, 0); parentSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); int x = parentLocation.x + (parentSize.width - prefSize.width) / 2; int y = parentLocation.y + (parentSize.height - prefSize.height) / 2; this.setLocation(x, y); this.setResizable(true); } catch (Exception e) { e.printStackTrace(); } }
public void drawItems() { itemList.removeAll(); OrderedItem orders[] = commande.getOrders(); for (int i = 0; i < orders.length; i++) { GridBagConstraints constraintLeft = new GridBagConstraints(), constraintRight = new GridBagConstraints(); constraintLeft.gridx = 0; constraintLeft.gridy = GridBagConstraints.RELATIVE; constraintLeft.fill = GridBagConstraints.HORIZONTAL; constraintRight.gridx = 1; constraintRight.gridy = GridBagConstraints.RELATIVE; constraintRight.fill = GridBagConstraints.HORIZONTAL; String itemText = orders[i].getItem().getNom(); if (itemText.length() > 15) { itemText = itemText.substring(0, 12) + "..."; } JLabel item = new JLabel(itemText); JPanel itemTextHolder = new JPanel(); itemTextHolder.setBorder(BorderFactory.createLineBorder(Color.BLUE)); itemTextHolder.setBackground(Color.WHITE); itemTextHolder.add(item); itemList.add(itemTextHolder, constraintLeft); Color bg = Color.WHITE; String statusIcon = ""; JLabel itemStatus = new JLabel(); JPanel statusHolder = new JPanel(); switch (orders[i].getStatus()) { case 0: bg = Color.RED; statusIcon = "\u2718"; break; case 1: bg = Color.YELLOW; statusIcon = "\u2718"; break; case 2: bg = Color.GREEN; statusIcon = "\u2718"; break; case 3: bg = Color.GRAY; statusIcon = "\u2713"; break; } itemStatus.setText(statusIcon); statusHolder.setBackground(bg); statusHolder.setBorder(BorderFactory.createLineBorder(Color.BLUE)); statusHolder.add(itemStatus); itemList.add(statusHolder, constraintRight); } validate(); repaint(); }
/** Lays all of the UI components used by the app into the mainframe's default container panel. */ private void layoutComponents() { final JPanel topPanel = layoutTopPanel(); final JPanel centerPanel = layoutCenterPanel(); final JPanel buttonPanel = layoutButtonPanel(); // when adding the content to the root panel we must follow the look & // feel guidelines which state 2 padding units between the edges of the // root panel and the components. If the bottom and right components // are 3D or shadowed components then it should be 2 padding units - 1 // for consistency. // the top panel gives us our border for the top and left sides final Border topBorder = BorderFactory.createEmptyBorder( LFPAD * 2, // top LFPAD * 2, // left 0, // bottom LFPAD * 2 - 1); // right topPanel.setBorder(topBorder); // the center border needs to have a visible separation from the top // panel components final Border centerBorder = BorderFactory.createEmptyBorder( LFPAD * 2, // top LFPAD * 2, // left 0, // bottom LFPAD * 2 - 1); // right centerPanel.setBorder(centerBorder); // the bottom panel gives us our border for the bottom and right sides // and also must be separated from the top panel by 3 padding units - 1 // to give any buttons appropriate spacing final Border bottomBorder = BorderFactory.createEmptyBorder( LFPAD * 3 - 1, // top LFPAD * 2, // left LFPAD * 2 - 1, // bottom LFPAD * 2 - 1); // right buttonPanel.setBorder(bottomBorder); // finally, change our root panel to have a BorderLayout and force the // top panel to use the North section and the bottom panel to use the // South section. this will allow the root panel to be resized freely // and the other panels should react correctly in both grow and shrink // resizing scenarios. final JPanel contentPanel = (JPanel) getContentPane(); contentPanel.setLayout(new BorderLayout()); contentPanel.add(topPanel, BorderLayout.NORTH); contentPanel.add(centerPanel, BorderLayout.CENTER); contentPanel.add(buttonPanel, BorderLayout.SOUTH); }
/** Constructor */ public ServiceFilterPanel(String text, Vector list) { empty_border = new EmptyBorder(5, 5, 0, 5); indent_border = new EmptyBorder(5, 25, 5, 5); service_box = new JCheckBox(text); service_box.addActionListener(this); service_data = new Vector(); if (list != null) { service_box.setSelected(true); service_data = (Vector) list.clone(); } service_list = new JList(service_data); service_list.setBorder(new EtchedBorder()); service_list.setVisibleRowCount(5); service_list.addListSelectionListener(this); service_list.setEnabled(service_box.isSelected()); service_scroll = new JScrollPane(service_list); service_scroll.setBorder(new EtchedBorder()); remove_service_button = new JButton("Remove"); remove_service_button.addActionListener(this); remove_service_button.setEnabled(false); remove_service_panel = new JPanel(); remove_service_panel.setLayout(new FlowLayout()); remove_service_panel.add(remove_service_button); service_area = new JPanel(); service_area.setLayout(new BorderLayout()); service_area.add(service_scroll, BorderLayout.CENTER); service_area.add(remove_service_panel, BorderLayout.EAST); service_area.setBorder(indent_border); add_service_field = new JTextField(); add_service_field.addActionListener(this); add_service_field.getDocument().addDocumentListener(this); add_service_field.setEnabled(service_box.isSelected()); add_service_button = new JButton("Add"); add_service_button.addActionListener(this); add_service_button.setEnabled(false); add_service_panel = new JPanel(); add_service_panel.setLayout(new BorderLayout()); JPanel dummy = new JPanel(); dummy.setBorder(empty_border); add_service_panel.add(dummy, BorderLayout.WEST); add_service_panel.add(add_service_button, BorderLayout.EAST); add_service_area = new JPanel(); add_service_area.setLayout(new BorderLayout()); add_service_area.add(add_service_field, BorderLayout.CENTER); add_service_area.add(add_service_panel, BorderLayout.EAST); add_service_area.setBorder(indent_border); setLayout(new BorderLayout()); add(service_box, BorderLayout.NORTH); add(service_area, BorderLayout.CENTER); add(add_service_area, BorderLayout.SOUTH); setBorder(empty_border); }
ThreadHeaderRenderer(int modelCol) { super(modelCol); sort = new JPanel(new BorderLayout()); sort.setBorder(new BevelBorder(BevelBorder.RAISED)); sort.add(new JLabel(threadSortIcon), BorderLayout.CENTER); unsort = new JPanel(new BorderLayout()); unsort.setBorder(new BevelBorder(BevelBorder.RAISED)); unsort.add(new JLabel(threadUnSortIcon), BorderLayout.CENTER); comp = unsort; }
public final void initializeGui() { // set up the main GUI gui.setBorder(new EmptyBorder(5, 5, 5, 5)); JToolBar tools = new JToolBar(); tools.setFloatable(false); gui.add(tools, BorderLayout.PAGE_START); tools.add(new JButton("New")); // TODO - add functionality! tools.addSeparator(); tools.add(new JLabel("Player:")); // TODO - add functionality! tools.addSeparator(); tools.add(message); playBoard = new JPanel(new GridLayout(0, 11)); playBoard.setBorder(new LineBorder(Color.BLACK)); gui.add(playBoard); // create the chess board squares Insets buttonMargin = new Insets(0, 0, 0, 0); for (int ii = 0; ii < playBoardSquares.length; ii++) { for (int jj = 0; jj < playBoardSquares[ii].length; jj++) { JButton b = new JButton(); b.setMargin(buttonMargin); // our chess pieces are 64x64 px in size, so we'll // 'fill this in' using a transparent icon.. ImageIcon icon = new ImageIcon(new BufferedImage(50, 50, BufferedImage.TYPE_INT_ARGB)); b.setIcon(icon); b.setBackground(Color.BLUE); playBoardSquares[jj][ii] = b; } } // fill the chess board playBoard.add(new JLabel("")); // fill the top row for (int ii = 0; ii < 10; ii++) { playBoard.add(new JLabel(COLS.substring(ii, ii + 1), SwingConstants.CENTER)); } // fill the black non-pawn piece row for (int ii = 0; ii < 10; ii++) { for (int jj = 0; jj < 10; jj++) { switch (jj) { case 0: playBoard.add(new JLabel("" + (ii + 1), SwingConstants.CENTER)); default: playBoard.add(playBoardSquares[jj][ii]); } } } }
private JPanel createTopPanel(YWorkItem item) { JPanel topPanel = new JPanel(new BorderLayout()); topPanel.setBackground(YAdminGUI._apiColour); JPanel leftPanel = new JPanel(new BorderLayout()); leftPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); JTextArea explanatoryText = new JTextArea(); explanatoryText.setText( "The data you submitted for this work item was \n" + "validated against a schema (see below). For some reason the\n" + "this data did not succeed in passing the constrainst set\n" + "inside the schema.\n" + "Usage Note: If this is causing problems try using the Web server\n" + "version of YAWL, which supports automatic forms generation.\n" + "Otherwise you could copy the schema from this page and use it\n " + "to create a valid output document using an XML development tool."); explanatoryText.setEditable(false); explanatoryText.setFont(new Font("Arial", Font.BOLD, 12)); explanatoryText.setForeground(Color.DARK_GRAY); explanatoryText.setBackground(YAdminGUI._apiColour); leftPanel.add(explanatoryText); topPanel.add(leftPanel, BorderLayout.WEST); JPanel rightPanel = new JPanel(new GridLayout(4, 2)); rightPanel.setBackground(YAdminGUI._apiColour); rightPanel.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Work Item Details"), BorderFactory.createEmptyBorder(10, 10, 10, 10))); YTask task = YEngine.getInstance().getTaskDefinition(item.getSpecificationID(), item.getTaskID()); String taskName = task.getName(); String[] text = { item.getSpecificationID().toString(), taskName, item.getIDString(), item.getStartTimeStr() }; String[] labels = {"Specification ID", "Task Name", "WorkItem ID", "Task Started"}; for (int i = 0; i < text.length; i++) { String s = text[i]; rightPanel.add(new JLabel(labels[i])); JTextField t = new JTextField(s); t.setEditable(false); rightPanel.add(t); } topPanel.add(rightPanel, BorderLayout.CENTER); return topPanel; }