/** * This function is used to re-run the analyser, and re-create the rows corresponding the its * results. */ private void refreshReviewTable() { reviewPanel.removeAll(); rows.clear(); GridBagLayout gbl = new GridBagLayout(); reviewPanel.setLayout(gbl); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridy = 0; try { Map<String, Long> sums = analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate()); for (Entry<String, Long> entry : sums.entrySet()) { String project = entry.getKey(); double hours = 1.0 * entry.getValue() / (1000 * 3600); addRow(gbl, gbc, project, hours); } for (String project : main.getProjectsTree().getTopLevelProjects()) if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0); gbc.insets = new Insets(10, 0, 0, 0); addLeftLabel(gbl, gbc, "TOTAL"); gbc.gridx = 1; gbc.weightx = 1; totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3)); gbl.setConstraints(totalLabel, gbc); reviewPanel.add(totalLabel); gbc.weightx = 0; addRightLabel(gbl, gbc); } catch (IOException e) { e.printStackTrace(); } recomputeTotal(); pack(); }
protected JPanel makeMessage() { JPanel p = new JPanel(new BorderLayout()); myMessage = new JTextField(30); p.setBorder(BorderFactory.createTitledBorder("message")); p.add(myMessage, BorderLayout.CENTER); return p; }
@NotNull EditorWindow[] getOrderedWindows() { final List<EditorWindow> res = new ArrayList<EditorWindow>(); // Collector for windows in tree ordering: class Inner { private void collect(final JPanel panel) { final Component comp = panel.getComponent(0); if (comp instanceof Splitter) { final Splitter splitter = (Splitter) comp; collect((JPanel) splitter.getFirstComponent()); collect((JPanel) splitter.getSecondComponent()); } else if (comp instanceof JPanel || comp instanceof JBTabs) { final EditorWindow window = findWindowWith(comp); if (window != null) { res.add(window); } } } } // get root component and traverse splitters tree: if (getComponentCount() != 0) { final Component comp = getComponent(0); LOG.assertTrue(comp instanceof JPanel); final JPanel panel = (JPanel) comp; if (panel.getComponentCount() != 0) { new Inner().collect(panel); } } LOG.assertTrue(res.size() == myWindows.size()); return res.toArray(new EditorWindow[res.size()]); }
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; }
public RobonoboFrame(RobonoboController control, String[] args) { this.control = control; this.cmdLineArgs = args; setTitle("robonobo"); setIconImage(GUIUtils.getImage("/icon/robonobo-64x64.png")); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener(new CloseListener()); menuBar = Platform.getPlatform().getMenuBar(this); setJMenuBar(menuBar); JPanel contentPane = new JPanel(); double[][] cellSizen = {{5, 200, 5, TableLayout.FILL, 5}, {3, TableLayout.FILL, 5}}; contentPane.setLayout(new TableLayout(cellSizen)); setContentPane(contentPane); leftSidebar = new LeftSidebar(this); contentPane.add(leftSidebar, "1,1"); mainPanel = new MainPanel(this); contentPane.add(mainPanel, "3,1"); setPreferredSize(new Dimension(1024, 723)); pack(); leftSidebar.selectMyMusic(); guiConfig = (GuiConfig) control.getConfig("gui"); addListeners(); }
public BrowserFrame(Browser b) { super("Cavity Nesting DB Browser"); browser = b; JPanel content = new JPanel(new BorderLayout()); content.setOpaque(true); setContentPane(content); content.add(browser, BorderLayout.CENTER); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); addWindowListener( new WindowAdapter() { public void windowClosed(WindowEvent e) { browser.closeBrowser(); } }); createJMenuBar(); setJMenuBar(menubar); setVisible(true); pack(); }
/** Show/update/hide page number field, according to loading policy and current data length. */ public final void updatePageNumber(int pageNr) { controlPageNr.setValue(new Integer(pageNr)); pageNrPanel.removeAll(); if (pageNr > 0 && showPageNumber) pageNrPanel.add(controlPageNr); pageNrPanel.revalidate(); this.repaint(); }
private Component createOptionsPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); onlyShowOutputOnErrorCheckBox = new JCheckBox("Only Show Output When Errors Occur"); onlyShowOutputOnErrorCheckBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { updateShowOutputOnErrorsSetting(); settingsNode.setValueOfChildAsBoolean( SHOW_OUTPUT_ON_ERROR, onlyShowOutputOnErrorCheckBox.isSelected()); } }); // initialize its default value boolean valueAsBoolean = settingsNode.getValueOfChildAsBoolean( SHOW_OUTPUT_ON_ERROR, onlyShowOutputOnErrorCheckBox.isSelected()); onlyShowOutputOnErrorCheckBox.setSelected(valueAsBoolean); updateShowOutputOnErrorsSetting(); panel.add(Utility.addLeftJustifiedComponent(onlyShowOutputOnErrorCheckBox)); return panel; }
// Metoden makeBoard - Skapar de grafiska komponenterna för spelplanen public void makeBoard() { int k = 0; // Laddar in bilderna för kortens baksida till programmet for (int j = 1; j < 33; j++) { for (int i = 0; i < 2; i++) { bilder.add(new ImageIcon("Memorypics/" + j + ".gif")); } } // Skapar korten med bilder och id, blandar sedan korten for (int i = 0; i < 64; i++) { cards.add(new Card(bilder.get(i), k)); if (i % 2 == 1) { k++; } Collections.shuffle(cards); } // Lägger ut korten på spelplanen for (int i = 0; i < 64; i++) { panel.add(cards.get(i)); cards.get(i).addActionListener(this); cards.get(i).setBorder(new LineBorder(Color.WHITE, 1)); cards.get(i).pos = i; } // Lägger till labels för nick och poängställning for (int i = 0; i < players.size(); i++) { playerlabels.add(new JLabel(players.get(i).nick + ": ")); scorelabels.add(new JLabel(players.get(i).score + "")); panel.add(playerlabels.get(i)); panel.add(scorelabels.get(i)); } }
/** * Creates the panel that appears when there are no pages * * @return JPanel */ protected JPanel createFirstPanel() { firstButtonPanel = new JPanel(new GridBagLayout()); firstButtonPanel.setBorder(BorderFactory.createLineBorder(Color.black)); firstButtonPanel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent _evt) { if (OSPRuntime.isPopupTrigger(_evt)) return; // SwingUtilities.isRightMouseButton(_evt)) return; if (!firstButtonPanel.isEnabled()) return; Object obj = JOptionPane.showInputDialog( getComponent(), res.getString("TabbedEditor.NewName"), res.getString("TabbedEditor.Rename"), JOptionPane.QUESTION_MESSAGE, null, null, getUniqueName(defaultString)); if (obj == null) return; String txt = obj.toString().trim(); if (txt.length() > 0) addPage(defaultType, txt, null, true); else addPage(defaultType, defaultString, null, true); } }); String label = res.getOptionalString("TabbedEditor.ClickHere." + defaultHeader); if (label == null) label = res.getString("TabbedEditor.ClickHere"); firstButton = new JLabel(label); firstButton.setFont(firstButton.getFont().deriveFont(TabbedEditor.BUTTON_FONT_SIZE)); firstButtonPanel.add(firstButton); JPanel firstPanel = new JPanel(new GridLayout(0, 1)); firstPanel.add(firstButtonPanel); return firstPanel; }
private Component createCurrentDirectoryPanel() { currentDirectoryTextField = new JTextField(); currentDirectoryTextField.setEditable(false); String currentDirectory = settingsNode.getValueOfChild(CURRENT_DIRECTORY, null); if (currentDirectory == null || "".equals(currentDirectory.trim())) { currentDirectory = gradlePluginLord.getCurrentDirectory().getAbsolutePath(); } currentDirectoryTextField.setText(currentDirectory); gradlePluginLord.setCurrentDirectory(new File(currentDirectory)); JButton browseButton = new JButton( new AbstractAction("Browse...") { public void actionPerformed(ActionEvent e) { File file = browseForDirectory(gradlePluginLord.getCurrentDirectory()); if (file != null) { setCurrentDirectory(file); } } }); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(Utility.addLeftJustifiedComponent(new JLabel("Current Directory"))); panel.add(createSideBySideComponent(currentDirectoryTextField, browseButton)); return panel; }
public void changePanel() { card.next(mainPanel); buttonPanel.removeAll(); ctl.setText("- Play -"); buttonPanel.add(ctl); buttonPanel.add(rank); buttonPanel.add(exit); buttonPanel.setOpaque(false); buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100); count++; memory[count] = new Memory(); menuPanel.setMemory(memory[count]); secondPanel.setMemory(memory[count]); gamePanel.setMemory(memory[count]); rankPanel.setMemory(memory, count); check = 0; System.out.println( count + " " + memory[count - 1].name + " " + memory[count - 1].song + " " + memory[count - 1].score); }
// This method starts a newGame by initializing everything that is necessary before calling the // game() method public void newGame() { // Calls the loadMap method to load the map for the game loadMap(); // Calls the createPlayers method to create the players needed for the game createPlayers(); // Starts the powerup manager to make powerups pum.startPowerUps(); // Makes the gamePanel the only visible panel gamePanel.setVisible(true); optionsPanel.setVisible(false); rulesPanel.setVisible(false); controlsPanel.setVisible(false); creditsPanel.setVisible(false); titlePanel.setVisible(false); // Resets some variables needed to play the game winPlayer = 5; deadPlayers = 0; // Calls the game() method to play the game game(); }
protected JPanel makeOutput() { JPanel p = new JPanel(new BorderLayout()); myOutput = new JTextArea(10, 40); p.setBorder(BorderFactory.createTitledBorder("output")); p.add(new JScrollPane(myOutput), BorderLayout.CENTER); return p; }
Server() { setSize(500, 100); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); thread = new Thread(this); clientList = new ArrayList<ClientData>(); sList = new ArrayList<ServerThread>(); JPanel panel = new JPanel(); panel.add(new JLabel("Port :")); portText = new JTextField(5); portText.setText("7777"); panel.add(portText); startButton = new JButton("Start server"); startButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { port = Integer.parseInt(portText.getText()); thread.start(); startButton.setEnabled(false); } catch (NumberFormatException ex) { JOptionPane.showMessageDialog(null, "B³êdny format numeru portu"); portText.setText(""); } } }); panel.add(startButton); l = new JLabel("Serwer jest nieaktywny"); panel.add(l); add(panel, BorderLayout.NORTH); }
/** * Return the JFrameContentPane property value. * * @return javax.swing.JPanel */ private /* WARNING: THIS METHOD WILL BE REGENERATED. */ javax.swing.JPanel getMainPanel() { if (ivjMainPanel == null) { try { ivjMainPanel = new javax.swing.JPanel(); ivjMainPanel.setName("MainPanel"); ivjMainPanel.setLayout(new java.awt.GridBagLayout()); ivjMainPanel.setBackground(java.awt.SystemColor.control); java.awt.GridBagConstraints constraintsProfileBrowserPanel = new java.awt.GridBagConstraints(); constraintsProfileBrowserPanel.gridx = 1; constraintsProfileBrowserPanel.gridy = 1; constraintsProfileBrowserPanel.fill = java.awt.GridBagConstraints.BOTH; constraintsProfileBrowserPanel.weightx = 1.0; constraintsProfileBrowserPanel.weighty = 1.0; constraintsProfileBrowserPanel.insets = new java.awt.Insets(2, 2, 2, 2); getMainPanel().add(getProfileBrowserPanel(), constraintsProfileBrowserPanel); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjMainPanel; }
private JPanel readSplitter( JPanel panel, Element splitterElement, Ref<EditorWindow> currentWindow) { final boolean orientation = "vertical".equals(splitterElement.getAttributeValue("split-orientation")); final float proportion = Float.valueOf(splitterElement.getAttributeValue("split-proportion")).floatValue(); final Element first = splitterElement.getChild("split-first"); final Element second = splitterElement.getChild("split-second"); Splitter splitter; if (panel == null) { panel = new JPanel(new BorderLayout()); panel.setOpaque(false); splitter = new Splitter(orientation, proportion, 0.1f, 0.9f); panel.add(splitter, BorderLayout.CENTER); splitter.setFirstComponent(readExternalPanel(first, null, currentWindow)); splitter.setSecondComponent(readExternalPanel(second, null, currentWindow)); } else if (panel.getComponent(0) instanceof Splitter) { splitter = (Splitter) panel.getComponent(0); readExternalPanel(first, (JPanel) splitter.getFirstComponent(), currentWindow); readExternalPanel(second, (JPanel) splitter.getSecondComponent(), currentWindow); } else { readExternalPanel(first, panel, currentWindow); readExternalPanel(second, panel, currentWindow); } return panel; }
void install() { Vector components = new Vector(); Vector indicies = new Vector(); int size = 0; JPanel comp = selectComponents.comp; Vector ids = selectComponents.filesets; for (int i = 0; i < comp.getComponentCount(); i++) { if (((JCheckBox) comp.getComponent(i)).getModel().isSelected()) { size += installer.getIntegerProperty("comp." + ids.elementAt(i) + ".real-size"); components.addElement(installer.getProperty("comp." + ids.elementAt(i) + ".fileset")); indicies.addElement(new Integer(i)); } } String installDir = chooseDirectory.installDir.getText(); Map osTaskDirs = chooseDirectory.osTaskDirs; Iterator keys = osTaskDirs.keySet().iterator(); while (keys.hasNext()) { OperatingSystem.OSTask osTask = (OperatingSystem.OSTask) keys.next(); String dir = ((JTextField) osTaskDirs.get(osTask)).getText(); if (dir != null && dir.length() != 0) { osTask.setEnabled(true); osTask.setDirectory(dir); } else osTask.setEnabled(false); } InstallThread thread = new InstallThread(installer, progress, installDir, osTasks, size, components, indicies); progress.setThread(thread); thread.start(); }
public MainPanel() { super(new BorderLayout()); JPanel p = new JPanel(new GridLayout(2, 1)); final JComboBox<String> c0 = makeComboBox(true, false); final JComboBox<String> c1 = makeComboBox(false, false); final JComboBox<String> c2 = makeComboBox(true, true); final JComboBox<String> c3 = makeComboBox(false, true); p.add(makeTitlePanel("setEditable(false)", Arrays.asList(c0, c1))); p.add(makeTitlePanel("setEditable(true)", Arrays.asList(c2, c3))); p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(p, BorderLayout.NORTH); add( new JButton( new AbstractAction("add") { @Override public void actionPerformed(ActionEvent e) { String str = new Date().toString(); for (JComboBox<String> c : Arrays.asList(c0, c1, c2, c3)) { MutableComboBoxModel<String> m = (MutableComboBoxModel<String>) c.getModel(); m.insertElementAt(str, m.getSize()); } } }), BorderLayout.SOUTH); setPreferredSize(new Dimension(320, 240)); }
private JPanel createCompPanel() { filesets = new Vector(); int count = installer.getIntegerProperty("comp.count"); JPanel panel = new JPanel(new GridLayout(count, 1)); String osClass = OperatingSystem.getOperatingSystem().getClass().getName(); osClass = osClass.substring(osClass.indexOf('$') + 1); for (int i = 0; i < count; i++) { String os = installer.getProperty("comp." + i + ".os"); if (os != null && !osClass.equals(os)) continue; JCheckBox checkBox = new JCheckBox( installer.getProperty("comp." + i + ".name") + " (" + installer.getProperty("comp." + i + ".disk-size") + "Mb)"); checkBox.getModel().setSelected(true); checkBox.addActionListener(this); checkBox.setRequestFocusEnabled(false); filesets.addElement(new Integer(i)); panel.add(checkBox); } Dimension dim = panel.getPreferredSize(); dim.width = Integer.MAX_VALUE; panel.setMaximumSize(dim); return panel; }
protected void showErrorPage(final ErrorInfo info) { storeState(); hideProgress(); myRootComponent = null; myErrorMessages.removeAll(); if (info.myShowStack) { info.myMessages.add( 0, new FixableMessageInfo(true, info.myDisplayMessage, "", "", null, null)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); info.myThrowable.printStackTrace(new PrintStream(stream)); myErrorStack.setText(stream.toString()); myErrorStackLayout.show(myErrorStackPanel, ERROR_STACK_CARD); } else { myErrorStack.setText(null); myErrorStackLayout.show(myErrorStackPanel, ERROR_NO_STACK_CARD); } for (FixableMessageInfo message : info.myMessages) { addErrorMessage( message, message.myErrorIcon ? Messages.getErrorIcon() : Messages.getWarningIcon()); } myErrorPanel.revalidate(); myLayout.show(this, ERROR_CARD); DesignerToolWindowManager.getInstance(getProject()).refresh(true); repaint(); }
/*-------------------------------------------------------------------------*/ public FoeTypeSelection(int dirtyFlag) { this.dirtyFlag = dirtyFlag; List<String> foeTypesList = new ArrayList<String>(Database.getInstance().getFoeTypes().keySet()); Collections.sort(foeTypesList); int max = foeTypesList.size(); checkBoxes = new HashMap<String, JCheckBox>(); JPanel panel = new JPanel(new GridLayout(max / 2 + 2, 2, 3, 3)); selectAll = new JButton("Select All"); selectAll.addActionListener(this); selectNone = new JButton("Select None"); selectNone.addActionListener(this); panel.add(selectAll); panel.add(selectNone); for (String s : foeTypesList) { JCheckBox cb = new JCheckBox(s); checkBoxes.put(s, cb); cb.addActionListener(this); panel.add(cb); } JScrollPane scroller = new JScrollPane(panel); this.add(scroller); }
private Content getOrCreateConsoleContent(final ContentManager contentManager) { final String displayName = VcsBundle.message("vcs.console.toolwindow.display.name"); Content content = contentManager.findContent(displayName); if (content == null) { releaseEditor(); final EditorFactory editorFactory = EditorFactory.getInstance(); final Editor editor = editorFactory.createViewer(editorFactory.createDocument(""), myProject); EditorSettings editorSettings = editor.getSettings(); editorSettings.setLineMarkerAreaShown(false); editorSettings.setIndentGuidesShown(false); editorSettings.setLineNumbersShown(false); editorSettings.setFoldingOutlineShown(false); ((EditorEx) editor).getScrollPane().setBorder(null); myEditorAdapter = new EditorAdapter(editor, myProject, false); final JPanel panel = new JPanel(new BorderLayout()); panel.add(editor.getComponent(), BorderLayout.CENTER); content = ContentFactory.SERVICE.getInstance().createContent(panel, displayName, true); contentManager.addContent(content); for (Pair<String, TextAttributes> pair : myPendingOutput) { myEditorAdapter.appendString(pair.first, pair.second); } myPendingOutput.clear(); } return content; }
public InjectionsSettingsUI(final Project project, final Configuration configuration) { myProject = project; myConfiguration = configuration; final CfgInfo currentInfo = new CfgInfo(configuration, "Project"); myInfos = configuration instanceof Configuration.Prj ? new CfgInfo[] { new CfgInfo(((Configuration.Prj) configuration).getParentConfiguration(), "IDE"), currentInfo } : new CfgInfo[] {currentInfo}; myRoot = new JPanel(new BorderLayout()); myInjectionsTable = new InjectionsTable(getInjInfoList(myInfos)); myInjectionsTable.getEmptyText().setText("No injections configured"); ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myInjectionsTable); createActions(decorator); // myRoot.add(new TitledSeparator("Languages injection places"), BorderLayout.NORTH); myRoot.add(decorator.createPanel(), BorderLayout.CENTER); myCountLabel = new JLabel(); myCountLabel.setHorizontalAlignment(SwingConstants.RIGHT); myCountLabel.setForeground(SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES.getFgColor()); myRoot.add(myCountLabel, BorderLayout.SOUTH); updateCountLabel(); }
/** * Builds reading lists tab. * * @return component. */ protected JComponent buildReadingListsTab() { // Wording JComponent wording = msg(Strings.message("guide.dialog.readinglists.wording")); // Buttons Dimension btnSize = new Dimension(20, 20); btnAddReadingList.setPreferredSize(btnSize); btnRemoveList.setPreferredSize(btnSize); FlowLayout layout = new FlowLayout(FlowLayout.LEFT); JPanel bbar = new JPanel(layout); bbar.add(btnAddReadingList); bbar.add(btnRemoveList); layout.setHgap(0); layout.setVgap(0); // Panel BBFormBuilder builder = new BBFormBuilder("0:grow"); builder.setDefaultDialogBorder(); builder.append(wording); builder.appendUnrelatedComponentsGapRow(2); builder.appendRow("min:grow"); builder.append(new JScrollPane(tblReadingLists), 1, CellConstraints.FILL, CellConstraints.FILL); builder.append(bbar); return builder.getPanel(); }
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 void enableControlPanel() { boolean bVisible = false; int nmembers = buttonPane.getComponentCount(); for (int k = 0; k < nmembers; k++) { Component comp = buttonPane.getComponent(k); if (comp != null) { if (comp.isVisible() || comp.isEnabled()) { bVisible = true; break; } } } if (bVisible && !buttonPane.isVisible()) { Dimension dim = getSize(); Dimension dim1 = buttonPane.getPreferredSize(); int w = dim.width; int h = dim.height + dim1.height; if (dim1.width > w) w = dim1.width; if (w < 300) w = 300; if (h < 200) h = 200; setSize(w, h); } buttonPane.setVisible(bVisible); }
/** Creates the attribute choices. Override to add additional choices. */ protected void createAttributeChoices(JPanel panel) { panel.add(new JLabel("Fill")); fFillColor = createColorChoice("FillColor"); panel.add(fFillColor); panel.add(new JLabel("Text")); fTextColor = createColorChoice("TextColor"); panel.add(fTextColor); panel.add(new JLabel("Pen")); fFrameColor = createColorChoice("FrameColor"); panel.add(fFrameColor); panel.add(new JLabel("Arrow")); CommandChoice choice = new CommandChoice(); fArrowChoice = choice; choice.addItem( new ChangeAttributeCommand( "none", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_NONE), this)); choice.addItem( new ChangeAttributeCommand( "at Start", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_START), this)); choice.addItem( new ChangeAttributeCommand( "at End", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_END), this)); choice.addItem( new ChangeAttributeCommand( "at Both", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_BOTH), this)); panel.add(fArrowChoice); panel.add(new JLabel("Font")); fFontChoice = createFontChoice(); panel.add(fFontChoice); }
/** Description of the Method */ public void init() { // super.init(); size = new Dimension(570, 570); contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(borderLayout1); Dimension d = messagePanel.getSize(); d.height += 20; messagePanel.setPreferredSize(d); contentPane.add(messagePanel, BorderLayout.SOUTH); contentPane.setOpaque(true); userPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(2, 2, 2, 2); messagePanel.setLayout(borderLayout5); contentPane.setOpaque(true); contentPane.setBackground(Color.white); this.setSize(size); messagePanel.add(labelMessage, BorderLayout.NORTH); // Logg.logg("MhClient: Före XttTree-skapande", 6); this.mhTable = new MhTable(root, false, this.labelMessage); // Logg.logg("MhClient: mhTable-skapande klart", 6); this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER); }
public AnimationFrame() { ArrayComponent comp = new ArrayComponent(); add(comp, BorderLayout.CENTER); final Sorter sorter = new Sorter(comp); JButton runButton = new JButton("Run"); runButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { sorter.setRun(); } }); JButton stepButton = new JButton("Step"); stepButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { sorter.setStep(); } }); JPanel buttons = new JPanel(); buttons.add(runButton); buttons.add(stepButton); add(buttons, BorderLayout.NORTH); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); Thread t = new Thread(sorter); t.start(); }