List of usage examples for javax.swing Box createHorizontalStrut
public static Component createHorizontalStrut(int width)
From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationMenuUI.java
protected static JPanel packHorizontallyLeftAligned(Component[] components, int leftOffset) { JPanel packed = new JPanel(); packed.setOpaque(false);/*from w w w . j ava2 s.c o m*/ packed.setLayout(new BoxLayout(packed, BoxLayout.X_AXIS)); if (leftOffset > 0) { packed.add(Box.createHorizontalStrut(leftOffset)); } int minW = 0, minH = 0; for (Component comp : components) { packed.add(comp); Dimension dim = comp.getMinimumSize(); minW += dim.getWidth(); minH = Math.max(minH, (int) dim.getHeight()); } packed.add(Box.createHorizontalGlue()); packed.setMinimumSize(new Dimension(minW, minH)); packed.setMaximumSize(new Dimension(4000, minH)); packed.setPreferredSize(new Dimension(4000, minH)); return packed; }
From source file:org.rdv.datapanel.DigitalTabularDataPanel.java
private void addColumn() { if (columnGroupCount == MAX_COLUMN_GROUP_COUNT) { return;//from w ww . ja va 2 s.c o m } if (columnGroupCount != 0) { panelBox.add(Box.createHorizontalStrut(7)); } final int tableIndex = columnGroupCount; final DataTableModel tableModel = new DataTableModel(); final JTable table = new JTable(tableModel); table.setDragEnabled(true); table.setName(DigitalTabularDataPanel.class.getName() + " JTable #" + Integer.toString(columnGroupCount)); if (showThresholdCheckBoxGroup.isSelected()) { tableModel.setThresholdVisible(true); } if (showMinMaxCheckBoxGroup.isSelected()) { tableModel.setMaxMinVisible(true); table.getColumn("Min").setCellRenderer(doubleCellRenderer); table.getColumn("Max").setCellRenderer(doubleCellRenderer); } table.getColumn("Value").setCellRenderer(dataCellRenderer); tables.add(table); tableModels.add(tableModel); JScrollPane tableScrollPane = new JScrollPane(table); panelBox.add(tableScrollPane); // popup menu for panel JPopupMenu popupMenu = new JPopupMenu(); final JMenuItem copyMenuItem = new JMenuItem("Copy"); copyMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { TransferHandler.getCopyAction().actionPerformed( new ActionEvent(table, ae.getID(), ae.getActionCommand(), ae.getWhen(), ae.getModifiers())); } }); popupMenu.add(copyMenuItem); popupMenu.addSeparator(); JMenuItem printMenuItem = new JMenuItem("Print..."); printMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { table.print(JTable.PrintMode.FIT_WIDTH); } catch (PrinterException pe) { } } }); popupMenu.add(printMenuItem); popupMenu.addSeparator(); final JCheckBoxMenuItem showMaxMinMenuItem = new JCheckBoxMenuItem("Show min/max columns", false); showMaxMinMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setMaxMinVisible(showMaxMinMenuItem.isSelected()); } }); showMinMaxCheckBoxGroup.addCheckBox(showMaxMinMenuItem); popupMenu.add(showMaxMinMenuItem); final JCheckBoxMenuItem showThresholdMenuItem = new JCheckBoxMenuItem("Show threshold columns", false); showThresholdMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setThresholdVisible(showThresholdMenuItem.isSelected()); } }); showThresholdCheckBoxGroup.addCheckBox(showThresholdMenuItem); popupMenu.add(showThresholdMenuItem); popupMenu.addSeparator(); JMenuItem blankRowMenuItem = new JMenuItem("Insert blank row"); blankRowMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tableModel.addBlankRow(); } }); popupMenu.add(blankRowMenuItem); final JMenuItem removeSelectedRowsMenuItem = new JMenuItem("Remove selected rows"); removeSelectedRowsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removeSelectedRows(tableIndex); } }); popupMenu.add(removeSelectedRowsMenuItem); popupMenu.addSeparator(); JMenu numberOfColumnsMenu = new JMenu("Number of columns"); numberOfColumnsMenu.addMenuListener(new MenuListener() { public void menuSelected(MenuEvent me) { JMenu menu = (JMenu) me.getSource(); for (int j = 0; j < MAX_COLUMN_GROUP_COUNT; j++) { JMenuItem menuItem = menu.getItem(j); boolean selected = (j == (columnGroupCount - 1)); menuItem.setSelected(selected); } } public void menuDeselected(MenuEvent me) { } public void menuCanceled(MenuEvent me) { } }); for (int i = 0; i < MAX_COLUMN_GROUP_COUNT; i++) { final int number = i + 1; JRadioButtonMenuItem item = new JRadioButtonMenuItem(Integer.toString(number)); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setNumberOfColumns(number); } }); numberOfColumnsMenu.add(item); } popupMenu.add(numberOfColumnsMenu); popupMenu.addPopupMenuListener(new PopupMenuListener() { public void popupMenuWillBecomeVisible(PopupMenuEvent arg0) { boolean anyRowsSelected = table.getSelectedRowCount() > 0; copyMenuItem.setEnabled(anyRowsSelected); removeSelectedRowsMenuItem.setEnabled(anyRowsSelected); } public void popupMenuWillBecomeInvisible(PopupMenuEvent arg0) { } public void popupMenuCanceled(PopupMenuEvent arg0) { } }); // set component popup and mouselistener to trigger it table.setComponentPopupMenu(popupMenu); tableScrollPane.setComponentPopupMenu(popupMenu); panelBox.revalidate(); columnGroupCount++; properties.setProperty("numberOfColumns", Integer.toString(columnGroupCount)); }
From source file:org.rdv.ui.ControlPanel.java
/** * Setup the UI./*from www.j a va2 s. c om*/ */ private void initPanel() { setLayout(new BorderLayout()); GridBagConstraints c = new GridBagConstraints(); JPanel container = new JPanel(); container.setLayout(new GridBagLayout()); Box firstRowPanel = new Box(BoxLayout.LINE_AXIS); beginButton = new JButton(); beginButton.setName("beginButton"); beginButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setLocationBegin(); } }); firstRowPanel.add(beginButton); rtButton = new JButton(); rtButton.setName("rtButton"); rtButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (rtButton.isSelected()) { rbnbController.pause(); } else { rbnbController.monitor(); } } }); firstRowPanel.add(rtButton); playButton = new JButton(); playButton.setName("playButton"); playButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (playButton.isSelected()) { rbnbController.pause(); } else { rbnbController.play(); } } }); firstRowPanel.add(playButton); endButton = new JButton(); endButton.setName("endButton"); endButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setLocationEnd(); } }); firstRowPanel.add(endButton); firstRowPanel.add(Box.createHorizontalStrut(8)); SpinnerListModel playbackRateModel = new SpinnerListModel(playbackRates); playbackRateSpinner = new JSpinner(playbackRateModel); playbackRateSpinner.setName("playbackRateSpinner"); JSpinner.ListEditor playbackRateEditor = new JSpinner.ListEditor(playbackRateSpinner); playbackRateEditor.getTextField().setEditable(false); playbackRateSpinner.setEditor(playbackRateEditor); playbackRateSpinner.setPreferredSize(new Dimension(80, playbackRateSpinner.getPreferredSize().height)); playbackRateSpinner.setMinimumSize(playbackRateSpinner.getPreferredSize()); playbackRateSpinner.setMaximumSize(playbackRateSpinner.getPreferredSize()); playbackRateSpinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { playbackRateChanged(); } }); firstRowPanel.add(playbackRateSpinner); firstRowPanel.add(Box.createHorizontalStrut(8)); timeScaleComboBox = new JComboBox(); timeScaleComboBox.setName("timeScaleComboBox"); timeScaleComboBox.setEditable(true); timeScaleComboBox.setPreferredSize(new Dimension(96, timeScaleComboBox.getPreferredSize().height)); timeScaleComboBox.setMinimumSize(timeScaleComboBox.getPreferredSize()); timeScaleComboBox.setMaximumSize(timeScaleComboBox.getPreferredSize()); for (int i = 0; i < timeScales.length; i++) { timeScaleComboBox.addItem(DataViewer.formatSeconds(timeScales[i])); } timeScaleComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { timeScaleChange(); } }); firstRowPanel.add(timeScaleComboBox); firstRowPanel.add(Box.createHorizontalGlue()); locationButton = new JButton(); locationButton.setName("locationButton"); locationButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { TimeRange timeRange = RBNBHelper.getChannelsTimeRange(); double time = DateTimeDialog.showDialog(ControlPanel.this, rbnbController.getLocation(), timeRange.start, timeRange.end); if (time >= 0) { rbnbController.setLocation(time); } } }); firstRowPanel.add(locationButton); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.weighty = 0; c.gridx = 0; c.gridy = 0; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.ipadx = 0; c.ipady = 0; c.insets = new java.awt.Insets(8, 8, 8, 8); c.anchor = GridBagConstraints.NORTHWEST; container.add(firstRowPanel, c); zoomTimeSlider = new TimeSlider(); zoomTimeSlider.setRangeChangeable(false); zoomTimeSlider.addTimeAdjustmentListener(this); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.weighty = 0; c.gridx = 0; c.gridy = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.ipadx = 0; c.ipady = 0; c.insets = new java.awt.Insets(0, 8, 0, 8); c.anchor = GridBagConstraints.NORTHWEST; container.add(zoomTimeSlider, c); JPanel zoomTimePanel = new JPanel(); zoomTimePanel.setLayout(new BorderLayout()); zoomMinimumLabel = new JLabel(); zoomMinimumLabel.setName("zoomMinimumLabel"); zoomTimePanel.add(zoomMinimumLabel, BorderLayout.WEST); zoomRangeLabel = new JLabel(); zoomRangeLabel.setName("zoomRangeLabel"); zoomRangeLabel.setHorizontalAlignment(JLabel.CENTER); zoomTimePanel.add(zoomRangeLabel, BorderLayout.CENTER); zoomMaximumLabel = new JLabel(); zoomMaximumLabel.setName("zoomMaximumLabel"); zoomTimePanel.add(zoomMaximumLabel, BorderLayout.EAST); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.weighty = 0; c.gridx = 0; c.gridy = 2; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.ipadx = 0; c.ipady = 0; c.insets = new java.awt.Insets(8, 8, 0, 8); c.anchor = GridBagConstraints.NORTHWEST; container.add(zoomTimePanel, c); globalTimeSlider = new TimeSlider(); globalTimeSlider.setValueChangeable(false); globalTimeSlider.addTimeAdjustmentListener(this); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.weighty = 1; c.gridx = 0; c.gridy = 3; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.ipadx = 0; c.ipady = 0; c.insets = new java.awt.Insets(8, 8, 8, 8); c.anchor = GridBagConstraints.NORTHWEST; container.add(globalTimeSlider, c); add(container, BorderLayout.CENTER); log.info("Initialized control panel."); }
From source file:org.rimudb.editor.RimuDBEditor.java
/** * Create and return a toolbar./*from w w w.ja v a 2s . c om*/ */ protected JToolBar createToolbar() { log.debug("createToolbar()"); JToolBar toolbar = new JToolBar(); // Open openBtn = new ToolbarButton(new OpenDescriptorAction(this, loadIcon("/images/famfamfam/folder.png")), "Open Table Descriptor"); openBtn.setText("Open"); openBtn.setName("openBtn"); toolbar.add(openBtn); // Save saveBtn = new ToolbarButton(new SaveDescriptorAction(this, loadIcon("/images/famfamfam/disk.png")), "Save Table Descriptor"); saveBtn.setText("Save"); saveBtn.setName("saveBtn"); toolbar.add(saveBtn); // A space // toolbar.add(Box.createHorizontalStrut(5)); // Clear clearBtn = new ToolbarButton(new ClearTableAction(this, loadIcon("/images/famfamfam/bin_closed.png")), "Clear"); clearBtn.setText("Clear"); clearBtn.setName("clearBtn"); toolbar.add(clearBtn); // Save as // saveAsBtn = new ToolbarButton(new SaveAsDescriptorAction(this, loadIcon("/images/sun/SaveAs24.gif")), "Save Table Descriptor as"); // saveAsBtn.setName("saveAsBtn"); // toolbar.add(saveAsBtn); // A space toolbar.addSeparator(); // Import from a database importBtn = new ToolbarButton(new ImportAction(this, loadIcon("/images/famfamfam/database_go.png")), "Import from database"); importBtn.setText("Import"); importBtn.setName("importBtn"); importBtn.setEnabled(false); toolbar.add(importBtn); // A space toolbar.add(Box.createHorizontalStrut(5)); // Create classes createBtn = new ToolbarButton( new GenerateJavaAction(this, loadIcon("/images/famfamfam/page_white_cup.png")), "Create classes"); createBtn.setText("Create"); createBtn.setName("createBtn"); toolbar.add(createBtn); // Finish up the tool bar toolbar.add(Box.createHorizontalGlue()); toolbar.setFloatable(false); return toolbar; }
From source file:org.stanwood.swing.AboutDialog.java
public void init() { Box box = Box.createVerticalBox(); if (icon == null) { createTitleArea(box, title, version); } else {/*from w w w. ja va 2 s .c o m*/ Box hbox = Box.createHorizontalBox(); hbox.add(Box.createHorizontalStrut(40)); hbox.add(new JLabel(icon)); hbox.add(Box.createHorizontalStrut(10)); box.add(hbox); Box vbox = Box.createVerticalBox(); createTitleArea(vbox, title, version); hbox.add(vbox); hbox.add(Box.createHorizontalGlue()); } JTabbedPane infoTabbedPane = new JTabbedPane(); infoTabbedPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JComponent tabAbout = createAboutTab(); infoTabbedPane.addTab("About", tabAbout); JComponent tabAuthors = createAuthorsTab(); infoTabbedPane.addTab("Authors", tabAuthors); box.add(infoTabbedPane); createButtonPane(box); setContentPane(box); setSize(450, 280); setLocationRelativeTo(getParent()); }
From source file:org.tellervo.desktop.io.ImportDialog.java
/** * Set up the button bar/* www . ja va2 s . c o m*/ */ private void setupButtonBar() { bottombar = new JPanel(); bottombar.setLayout(new BoxLayout(bottombar, BoxLayout.X_AXIS)); editEntity = new JToggleButton(); editEntity.setIcon(Builder.getIcon("lock.png", Builder.ICONS, 22)); editEntity.setSelectedIcon(Builder.getIcon("unlock.png", Builder.ICONS, 22)); editEntity.setBorderPainted(false); editEntity.setContentAreaFilled(false); editEntity.setFocusable(false); editEntity.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!editEntity.isSelected() && hasChanged) { if (!warnLosingChanges()) { editEntity.setSelected(true); return; } else { editEntity.setSelected(false); hasChanged = false; } } //enableEditing(editEntity.isSelected()); } }); bottombar.add(editEntity); editEntityText = new JLabel(I18n.getText("general.initializing").toLowerCase()); editEntityText.setLabelFor(editEntity); bottombar.add(editEntityText); editEntitySave = new JButton(I18n.getText("general.saveChanges")); editEntityCancel = new JButton(I18n.getText("general.cancel")); // don't let an errant enter key fire these buttons! editEntitySave.setDefaultCapable(false); editEntityCancel.setDefaultCapable(false); editEntitySave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //doSave(); } }); editEntityCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { hasChanged = false; editEntity.setSelected(false); //enableEditing(false); } }); bottombar.add(Box.createHorizontalGlue()); bottombar.add(editEntitySave); bottombar.add(Box.createHorizontalStrut(6)); bottombar.add(editEntityCancel); bottombar.add(Box.createHorizontalStrut(6)); }
From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewer.java
private void initComponents() { setLayout(new BorderLayout()); // create button panel JPanel topPanel = new JPanel(); btnTreeView = new JRadioButton("Tree"); btnTreeView.putClientProperty("cv.cardName", TREEPANEL); btnTableView = new JRadioButton("Table"); btnTableView.putClientProperty("cv.cardName", TABLEPANEL); ActionListener btnListener = new ActionListener() { public void actionPerformed(ActionEvent e) { // show the right layout panel String v = (String) ((AbstractButton) e.getSource()).getClientProperty("cv.cardName"); if (v != null) ((CardLayout) contentPanel.getLayout()).show(contentPanel, v); }/*from w ww . j a va 2 s . c o m*/ }; btnTableView.addActionListener(btnListener); btnTreeView.addActionListener(btnListener); // connect buttons ButtonGroup group = new ButtonGroup(); group.add(btnTreeView); group.add(btnTableView); topPanel.setLayout(new MigLayout("", "[64px][55px][62px][grow]", "[][23px]")); lblViewAllThe = new JLabel( "<html>View all the component series that combine to create the current series. Series can be viewed as:"); topPanel.add(lblViewAllThe, "cell 0 0 4 1"); JRadioButton btnTree2View = new JRadioButton("Flow chart"); btnTree2View.putClientProperty("cv.cardName", TREE2PANEL); btnTree2View.addActionListener(btnListener); group.add(btnTree2View); topPanel.add(btnTree2View, "cell 0 1,alignx left,aligny center"); topPanel.add(btnTreeView, "cell 1 1,alignx left,aligny center"); topPanel.add(btnTableView, "cell 2 1,alignx left,aligny center"); topPanel.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8)); add(topPanel, BorderLayout.NORTH); // create status bar JPanel status = new JPanel(); status.setLayout(new BoxLayout(status, BoxLayout.X_AXIS)); txtStatus = new JLabel(""); pbStatus = new JProgressBar(); pbStatus.setVisible(false); status.add(txtStatus); status.add(Box.createHorizontalStrut(8)); status.add(pbStatus); status.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); add(status, BorderLayout.SOUTH); contentPanel = new JPanel(new CardLayout()); add(contentPanel, BorderLayout.CENTER); tablePanel = new JPanel(new BorderLayout()); setupTable(); tablePanel.add(new JScrollPane(table), BorderLayout.CENTER); treePanel = new JPanel(new BorderLayout()); setupTree(); treePanel.add(new JScrollPane(tree), BorderLayout.CENTER); tree2Panel = new JPanel(new BorderLayout()); setupTreeGUI(); contentPanel.add(tablePanel, TABLEPANEL); contentPanel.add(treePanel, TREEPANEL); contentPanel.add(tree2Panel, TREE2PANEL); }
From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewerOld.java
private void initComponents() { JLabel label;//from www . j a v a 2 s. c om setLayout(new BorderLayout()); // create button panel JPanel topPanel = new JPanel(); label = new JLabel("View as: "); btnTreeView = new JRadioButton("tree"); btnTreeView.putClientProperty("cv.cardName", TREEPANEL); btnTableView = new JRadioButton("table"); btnTableView.putClientProperty("cv.cardName", TABLEPANEL); ActionListener btnListener = new ActionListener() { public void actionPerformed(ActionEvent e) { // show the right layout panel String v = (String) ((AbstractButton) e.getSource()).getClientProperty("cv.cardName"); if (v != null) ((CardLayout) contentPanel.getLayout()).show(contentPanel, v); } }; btnTableView.addActionListener(btnListener); btnTreeView.addActionListener(btnListener); // connect buttons ButtonGroup group = new ButtonGroup(); group.add(btnTreeView); group.add(btnTableView); topPanel.setLayout(new MigLayout("", "[64px][55px][62px][63px][][]", "[23px]")); // add it all to a panel topPanel.add(label, "cell 0 0,alignx left,aligny center"); topPanel.add(btnTreeView, "cell 1 0,alignx left,aligny center"); topPanel.add(btnTableView, "cell 2 0,alignx left,aligny center"); topPanel.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8)); add(topPanel, BorderLayout.NORTH); JButton btnOrder = new JButton("Order"); btnOrder.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { } }); topPanel.add(btnOrder, "cell 5 0"); // create status bar JPanel status = new JPanel(); status.setLayout(new BoxLayout(status, BoxLayout.X_AXIS)); txtStatus = new JLabel(""); pbStatus = new JProgressBar(); pbStatus.setVisible(false); status.add(txtStatus); status.add(Box.createHorizontalStrut(8)); status.add(pbStatus); status.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); add(status, BorderLayout.SOUTH); contentPanel = new JPanel(new CardLayout()); add(contentPanel, BorderLayout.CENTER); tablePanel = new JPanel(new BorderLayout()); setupTable(); tablePanel.add(new JScrollPane(table), BorderLayout.CENTER); treePanel = new JPanel(new BorderLayout()); setupTree(); treePanel.add(new JScrollPane(tree), BorderLayout.CENTER); tree2Panel = new JPanel(new BorderLayout()); createTree(); //setupTreeGUI(); contentPanel.add(tablePanel, TABLEPANEL); contentPanel.add(treePanel, TREEPANEL); contentPanel.add(tree2Panel, TREE2PANEL); }
From source file:org.trianacode.gui.hci.ApplicationFrame.java
/** * Initialises the panels in the main window *//* w w w.ja v a 2 s .c om*/ private void initLayout() { GUIEnv.setApplicationFrame(this); ColorManager.setDefaultColorModel(new TrianaColorModel()); ColorManager.registerColorModel(ScriptConstants.SCRIPT_RENDERING_HINT, new ScriptColorModel()); // do this after all other color loading ColorTable.instance().loadUserPrefs(); TaskGraphView defaultview = new TaskGraphView("Default View"); TrianaComponentModel compmodel = new TrianaComponentModel(tools, this, this); defaultview.setDefaultToolModel(compmodel); defaultview.setDefaultOpenGroupModel(compmodel); defaultview.registerToolModel(ScriptConstants.SCRIPT_RENDERING_HINT, new ScriptComponentModel()); defaultview.registerToolModel(TextToolConstants.TEXT_TOOL_RENDERING_HINT, new TextToolComponentModel()); defaultview.registerToolModel(HiddenToolConstants.HIDDEN_RENDERING_HINT, new HiddenComponentModel()); TaskGraphView mapview = new TaskGraphView("Map View", defaultview); mapview.registerOpenGroupModel(MapConstants.MAP_RENDERING_HINT, new MapComponentModel()); mapview.registerToolModel(MapConstants.MAP_LOCATION_RENDERING_HINT, new MapLocationComponentModel()); TaskGraphViewManager.setDefaultTaskGraphView(defaultview); TaskGraphViewManager.registerTaskGraphView(MapConstants.MAP_RENDERING_HINT, mapview); taskGraphFileHandler = new TaskGraphFileHandler(); trianaMenuBar = new TrianaMainMenu(this, tools); this.setJMenuBar(trianaMenuBar); TrianaShutdownHook shutDownHook = new TrianaShutdownHook(); Runtime.getRuntime().addShutdownHook(shutDownHook); getDesktopViewManager().addDesktopViewListener(this); this.workspace.add(getDesktopViewManager().getWorkspace(), BorderLayout.CENTER); ((TrianaMainMenu) trianaMenuBar).addHelp(); ToolTreeModel treemodel = new ToolTreeModel(tools); toolboxTree = new JTree(treemodel); toolboxTree.addFocusListener(this); toolboxTree.setCellRenderer(new TrianaTreeRenderer()); toolmonitor.setTree(toolboxTree); treemodel.addTreeModelListener(this); ToolTipManager.sharedInstance().registerComponent(toolboxTree); ToolTipManager.sharedInstance().setInitialDelay(TOOL_TIP_SHOW_DELAY); ToolTipManager.sharedInstance().setDismissDelay(TOOL_TIP_HIDE_DELAY); //set up key maps MainTrianaKeyMapFactory keymaps = new MainTrianaKeyMapFactory(this, ActionDisplayOptions.DISPLAY_NAME); InputMap inputMap = keymaps.getInputMap(); inputMap.setParent(this.getRootPane().getInputMap()); this.getRootPane().setInputMap(JComponent.WHEN_FOCUSED, inputMap); ActionMap actMap = keymaps.getActionMap(); actMap.setParent(this.getRootPane().getActionMap()); this.getRootPane().setActionMap(actMap); leaflistener = new LeafListener(toolboxTree, this, tools); keymaps = new MainTrianaKeyMapFactory(leaflistener, ActionDisplayOptions.DISPLAY_NAME); inputMap = keymaps.getInputMap(); inputMap.setParent(toolboxTree.getInputMap()); toolboxTree.setInputMap(JComponent.WHEN_FOCUSED, inputMap); actMap = keymaps.getActionMap(); actMap.setParent(toolboxTree.getActionMap()); toolboxTree.setActionMap(actMap); toolboxTree.addMouseListener(leaflistener); toolboxTree.addMouseMotionListener(leaflistener); //toolboxTree.setRootVisible(false); JPanel toolPanel = new JPanel(new BorderLayout()); SearchToolBar searchtoolbar = new SearchToolBar("Search", toolboxTree, treemodel); searchtoolbar.setFloatable(false); toolPanel.add(searchtoolbar, BorderLayout.NORTH); JScrollPane scroll = new JScrollPane(toolboxTree); toolPanel.add(scroll, BorderLayout.CENTER); JSplitPane verticalSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, toolPanel, workspace); TrianaToolBar toolbar = new TrianaToolBar("Main ToolBar", this); TrianaUnitToolBar unitToolbar = new TrianaUnitToolBar("Unit ToolBar"); toolbar.setRollover(true); unitToolbar.setRollover(true); JPanel innerpanel = new JPanel(); innerpanel.setLayout(new BoxLayout(innerpanel, BoxLayout.X_AXIS)); innerpanel.add(toolbar); innerpanel.add(Box.createHorizontalStrut(10)); innerpanel.add(unitToolbar); innerpanel.add(Box.createHorizontalGlue()); JPanel outerpanel = new JPanel(new BorderLayout()); outerpanel.add(innerpanel, BorderLayout.NORTH); outerpanel.add(verticalSplit, BorderLayout.CENTER); getContentPane().add(outerpanel); }
From source file:org.ut.biolab.medsavant.client.util.VisibleMedSavantWorker.java
public VisibleMedSavantWorker(String pageName, String title) { super(pageName); view = ViewUtil.getClearPanel();//from w w w. j a v a 2s. c o m view.setOpaque(false); view.setBorder(ViewUtil.getMediumBorder()); view.setLayout(new BoxLayout(view, BoxLayout.Y_AXIS)); this.title = title; titleLabel = new JLabel(title); titleLabel.setFont(new java.awt.Font("Arial", java.awt.Font.BOLD, 12)); statusLabel = new JLabel(); progressBar = ViewUtil.getIndeterminateProgressBar(); resultsButton = ViewUtil.getSoftButton("View Results"); cancelButton = ViewUtil.getSoftButton("Cancel"); closeButton = ViewUtil.getSoftButton("Close"); resultsButton.setVisible(false); closeButton.setVisible(false); resultsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { showResults(); } }); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { // setStatus(JobStatus.CANCELLED); cancel(true); } }); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { closeJob(); } }); JPanel buttonBar = ViewUtil.getClearPanel(); ViewUtil.applyHorizontalBoxLayout(buttonBar); buttonBar.add(resultsButton); buttonBar.add(cancelButton); buttonBar.add(closeButton); JPanel statusPanel = ViewUtil.getClearPanel(); ViewUtil.applyHorizontalBoxLayout(statusPanel); statusPanel.add(statusLabel); statusPanel.add(Box.createHorizontalStrut(20)); statusPanel.add(Box.createHorizontalGlue()); statusPanel.add(progressBar); statusPanel.setPreferredSize(new Dimension(300, 25)); statusPanel.setMinimumSize(new Dimension(300, 25)); view.add(ViewUtil.alignLeft(titleLabel)); view.add(statusPanel); view.add(ViewUtil.alignRight(buttonBar)); setStatus(JobStatus.NOT_STARTED); }