List of usage examples for javax.swing JSplitPane HORIZONTAL_SPLIT
int HORIZONTAL_SPLIT
To view the source code for javax.swing JSplitPane HORIZONTAL_SPLIT.
Click Source Link
Component
s are split along the x axis. From source file:de.codesourcery.eve.skills.ui.components.impl.BlueprintBrowserComponent.java
@Override protected JPanel createPanel() { popupMenuBuilder.addItem("Create production plan...", new AbstractAction() { @Override/*from w w w .j a va 2 s. c o m*/ public boolean isEnabled() { return blueprintChooser.getCurrentlySelectedBlueprint() != null; } @Override public void actionPerformed(ActionEvent e) { final Blueprint blueprint = blueprintChooser.getCurrentlySelectedBlueprint(); if (blueprint != null) { doubleClicked(blueprint); } } }); // add text fields final JPanel textFields = new JPanel(); textFields.setLayout(new GridBagLayout()); selectedME.setColumns(5); selectedPE.setColumns(5); quantity.setColumns(6); selectedME.setHorizontalAlignment(JTextField.RIGHT); selectedPE.setHorizontalAlignment(JTextField.RIGHT); quantity.setHorizontalAlignment(JTextField.RIGHT); selectedME.addActionListener(this); selectedPE.addActionListener(this); quantity.addActionListener(this); textFields.add(new JLabel("ME"), constraints(0, 0).resizeBoth().end()); textFields.add(selectedME, constraints(1, 0).weightX(0.1).anchorWest().end()); textFields.add(new JLabel("PE"), constraints(0, 1).resizeBoth().end()); textFields.add(selectedPE, constraints(1, 1).weightX(0.1).anchorWest().end()); textFields.add(new JLabel("Quantity"), constraints(0, 2).resizeBoth().end()); textFields.add(quantity, constraints(1, 2).weightX(0.1).anchorWest().end()); // add combobox with cost calculators // add POS / NPC station buttons + label JPanel buttonPanel = new JPanel(); final ButtonGroup group = new ButtonGroup(); group.add(posButton); group.add(npcStationButton); posButton.addActionListener(this); npcStationButton.addActionListener(this); buttonPanel.add(posButton); buttonPanel.add(npcStationButton); textFields.add(new JLabel("Location"), constraints(0, 3).noResizing().end()); textFields.add(buttonPanel, constraints(1, 3).useRemainingWidth().end()); // add text area textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); setMonospacedFont(textArea); final JPanel rightPanel = new JPanel(); rightPanel.setLayout(new GridBagLayout()); rightPanel.add(textFields, constraints(0, 0).noResizing().end()); rightPanel.add(new JScrollPane(textArea), constraints(0, 1).useRemainingSpace().end()); final ImprovedSplitPane splitPane = new ImprovedSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.blueprintChooser.createPanel(), rightPanel); splitPane.setDividerLocation(0.4); final JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); panel.add(splitPane, constraints(0, 0).resizeBoth().end()); return panel; }
From source file:com.emental.mindraider.ui.frames.MindRaiderMainWindow.java
private MindRaiderMainWindow() { super(MindRaider.getTitle(), Gfx.getGraphicsConfiguration()); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);// ww w . j a va 2s. c o m } }); // catch resize addComponentListener(this); configuration = new ConfigurationBean(); // drag & drop registration DropTarget dropTarget = new DropTarget(this, (DropTargetListener) this); this.setDropTarget(dropTarget); // warn on different java version // checkJavaVersion(); singleton = this; setIconImage(IconsRegistry.getImage("programIcon.gif")); SplashScreen splash = new SplashScreen(this, false); splash.showSplashScreen(); // kernel init MindRaider.preSetProfiles(); // message in here because of locales logger.debug(Messages.getString("MindRaiderJFrame.bootingKernel")); // master control panel MindRaider.setMasterToolBar(new MasterToolBar()); getContentPane().add(MindRaider.masterToolBar, BorderLayout.NORTH); // status bar getContentPane().add(StatusBar.getStatusBar(), BorderLayout.SOUTH); // build menu buildMenu(MindRaider.spidersGraph); // profile MindRaider.setProfiles(); // left sidebar: folder/notebooks hierarchy, taxonomies, ... final JTabbedPane leftSidebar = new JTabbedPane(SwingConstants.BOTTOM); leftSidebar.setTabPlacement(SwingConstants.TOP); // TODO add icons to tabs leftSidebar.addTab(Messages.getString("MindRaiderJFrame.explorer"), ExplorerJPanel.getInstance()); // TODO just blank panel //leftSidebar.addTab("Tags",new OutlookBarMain()); leftSidebar.addTab( Messages.getString("MindRaiderJFrame.trash"), /* IconsRegistry.getImageIcon("trashFull.png"), */ TrashJPanel.getInstance()); leftSidebar.setSelectedIndex(0); leftSidebar.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { if (arg0.getSource() instanceof JTabbedPane) { if (leftSidebar.getSelectedIndex() == 1) { // refresh trash TrashJPanel.getInstance().refresh(); } } } }); // main panel: (notebook outline & RDF Navigator) + Control panel JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(OutlineJPanel.getInstance(), BorderLayout.CENTER); // split: left sidebar/main panel leftSidebarSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSidebar, mainPanel); leftSidebarSplitPane.setOneTouchExpandable(true); leftSidebarSplitPane.setDividerLocation(200); leftSidebarSplitPane.setLastDividerLocation(200); leftSidebarSplitPane.setDividerSize(6); leftSidebarSplitPane.setContinuousLayout(true); getContentPane().add(leftSidebarSplitPane, BorderLayout.CENTER); Gfx.centerAndShowWindow(this, 1024, 768); MindRaider.postSetProfiles(); if (!configuration.isShowSpidersTagSnailPane()) { OutlineJPanel.getInstance().hideSpiders(); } splash.hideSplash(); }
From source file:bio.gcat.gui.BDATool.java
public BDATool() { super("BDA Tool - " + AnalysisTool.NAME); setIconImage(getImage("bda")); setMinimumSize(new Dimension(660, 400)); setPreferredSize(new Dimension(1020, 400)); setSize(getPreferredSize());/*from www .ja v a2 s .com*/ setLocationByPlatform(true); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); menubar = new JMenuBar(); menu = new JMenu[4]; menubar.add(menu[0] = new JMenu("File")); menubar.add(menu[1] = new JMenu("Edit")); menubar.add(menu[2] = new JMenu("Window")); menubar.add(menu[3] = new JMenu("Help")); setJMenuBar(menubar); menu[0].add(createMenuItem("Open...", "folder-horizontal-open", KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK), ACTION_OPEN, this)); menu[0].add(createMenuItem("Save As...", "disk--arrow", KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK), ACTION_SAVE_AS, this)); menu[0].add(createSeparator()); menu[0].add(createMenuItem("Close Window", "cross", ACTION_CLOSE, this)); menu[1].add(createMenuText("Binary Dichotomic Algorithm:")); menu[1].add(createMenuItem("Add", KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK), ACTION_BDA_ADD, this)); menu[1].add(createMenuItem("Edit...", KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK), ACTION_BDA_EDIT, this)); menu[1].add( createMenuItem("Remove", KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), ACTION_BDA_REMOVE, this)); menu[1].add(createMenuItem("Clear", ACTION_BDAS_CLEAR, this)); menu[1].add(seperateMenuItem(createMenuItem("Move Up", KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_DOWN_MASK), ACTION_BDA_MOVE_UP, this))); menu[1].add(createMenuItem("Move Down", KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_DOWN_MASK), ACTION_BDA_MOVE_DOWN, this)); menu[2].add(createMenuItem("Preferences", ACTION_PREFERENCES, this)); menu[3].add(createMenuItem("About BDA Tool", "bda", ACTION_ABOUT, this)); for (String action : new String[] { ACTION_BDA_EDIT, ACTION_BDA_REMOVE, ACTION_BDAS_CLEAR, ACTION_BDA_MOVE_UP, ACTION_BDA_MOVE_DOWN }) getMenuItem(menubar, action).setEnabled(false); getMenuItem(menubar, ACTION_PREFERENCES).setEnabled(false); registerKeyStroke(getRootPane(), KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "remove", new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (bdaPanel.table.hasFocus()) removeBinaryDichotomicAlgorithm(); } }); toolbar = new JToolBar[1]; toolbar[0] = new JToolBar("File"); toolbar[0].add(createToolbarButton("Open File", "folder-horizontal-open", ACTION_OPEN, this)); toolbar[0].add(createToolbarButton("Save As File", "disk--arrow", ACTION_SAVE_AS, this)); toolbars = new JPanel(new FlowLayout(FlowLayout.LEADING)); for (JToolBar toolbar : toolbar) toolbars.add(toolbar); add(toolbars, BorderLayout.NORTH); add(createSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, true, 360, 0.195, new JScrollPane(bdaPanel = new BinaryDichotomicAlgorithmPanel()), new JScrollPane(tablePanel = new JPanel(new BorderLayout()))), BorderLayout.CENTER); add(bottom = new JPanel(new FlowLayout(FlowLayout.RIGHT)), BorderLayout.SOUTH); status = new JLabel(); status.setBorder(new EmptyBorder(0, 5, 0, 5)); status.setHorizontalAlignment(JLabel.RIGHT); bottom.add(status); ((ListTableModel<?>) bdaPanel.table.getModel()).addListDataListener(this); bdaPanel.table.getSelectionModel().addListSelectionListener(this); revalidateGeneticCodeTable(); }
From source file:de.codesourcery.eve.skills.ui.components.impl.planning.CalendarComponent.java
@Override protected JPanel createPanel() { addEntryButton.setEnabled(false);/*from w w w .ja va2s .c om*/ addEntryButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addNewCalendarEntry(); } }); calendarWidget.addSelectionListener(new ISelectionListener<Date>() { @Override public void selectionChanged(Date selected) { addEntryButton.setEnabled(selected != null); tableModel.refresh(); } }); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() != 2 || e.isPopupTrigger()) { return; } final int viewRow = table.rowAtPoint(e.getPoint()); if (viewRow != -1) { editCalendarEntry(tableModel.getRow(table.convertRowIndexToModel(viewRow))); } } }); table.setFillsViewportHeight(true); table.setRowSorter(tableModel.getRowSorter()); table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); final PopupMenuBuilder menuBuilder = new PopupMenuBuilder(); menuBuilder.addItem("Remove", new AbstractAction() { @Override public boolean isEnabled() { return !ArrayUtils.isEmpty(table.getSelectedRows()); } @Override public void actionPerformed(ActionEvent e) { final int[] viewRows = table.getSelectedRows(); if (ArrayUtils.isEmpty(viewRows)) { return; } final int[] modelRows = new int[viewRows.length]; int i = 0; for (int viewRow : viewRows) { modelRows[i++] = table.convertRowIndexToModel(viewRow); } final List<ICalendarEntry> removedEntries = new ArrayList<ICalendarEntry>(); for (int modelRow : modelRows) { removedEntries.add(tableModel.getRow(modelRow)); } for (ICalendarEntry toBeRemoved : removedEntries) { calendarManager.getCalendar().deleteEntry(toBeRemoved); } } }); menuBuilder.addItem("Edit...", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { final int modelRow = table.convertRowIndexToModel(table.getSelectedRows()[0]); editCalendarEntry(tableModel.getRow(modelRow)); } @Override public boolean isEnabled() { return !ArrayUtils.isEmpty(table.getSelectedRows()); } }); menuBuilder.attach(table); // controls panel final JPanel controlsPanel = new JPanel(); controlsPanel.setLayout(new GridBagLayout()); controlsPanel.add(addEntryButton, constraints(0, 0).noResizing().end()); // combine panels final JPanel subPanel = new JPanel(); subPanel.setLayout(new GridBagLayout()); subPanel.add(controlsPanel, constraints(0, 0).useRelativeWidth().weightY(0).end()); subPanel.add(new JScrollPane(table), constraints(0, 1).useRelativeWidth().useRemainingHeight().end()); final ImprovedSplitPane splitPane = new ImprovedSplitPane(JSplitPane.HORIZONTAL_SPLIT, calendarWidget, subPanel); splitPane.setDividerLocation(0.7); final JPanel result = new JPanel(); result.setLayout(new GridBagLayout()); result.add(splitPane, constraints(0, 0).resizeBoth().end()); return result; }
From source file:org.datacleaner.widgets.result.ValueDistributionResultSwingRendererGroupDelegate.java
public JSplitPane renderGroupResult(final ValueCountingAnalyzerResult result) { final Integer distinctCount = result.getDistinctCount(); final Integer unexpectedValueCount = result.getUnexpectedValueCount(); final int totalCount = result.getTotalCount(); _valueCounts = result.getReducedValueFrequencies(_preferredSlices); _valueCounts = moveUniqueToEnd(_valueCounts); for (ValueFrequency valueCount : _valueCounts) { setDataSetValue(valueCount.getName(), valueCount.getCount()); }/* w ww .j av a2s. c o m*/ logger.info("Rendering with {} slices", getDataSetItemCount()); drillToOverview(result); // chart for display of the dataset String title = "Value distribution of " + _groupOrColumnName; final JFreeChart chart = ChartFactory.createBarChart(title, "Value", "Count", _dataset, PlotOrientation.HORIZONTAL, true, true, false); List<Title> titles = new ArrayList<Title>(); titles.add(new ShortTextTitle("Total count: " + totalCount)); if (distinctCount != null) { titles.add(new ShortTextTitle("Distinct count: " + distinctCount)); } if (unexpectedValueCount != null) { titles.add(new ShortTextTitle("Unexpected value count: " + unexpectedValueCount)); } chart.setSubtitles(titles); ChartUtils.applyStyles(chart); // code-block for tweaking style and coloring of chart { final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.getDomainAxis().setVisible(false); int colorIndex = 0; for (int i = 0; i < getDataSetItemCount(); i++) { final String key = getDataSetKey(i); final Color color; final String upperCaseKey = key.toUpperCase(); if (_valueColorMap.containsKey(upperCaseKey)) { color = _valueColorMap.get(upperCaseKey); } else { if (i == getDataSetItemCount() - 1) { // the last color should not be the same as the first if (colorIndex == 0) { colorIndex++; } } Color colorCandidate = SLICE_COLORS[colorIndex]; int darkAmount = i / SLICE_COLORS.length; for (int j = 0; j < darkAmount; j++) { colorCandidate = WidgetUtils.slightlyDarker(colorCandidate); } color = colorCandidate; colorIndex++; if (colorIndex >= SLICE_COLORS.length) { colorIndex = 0; } } plot.getRenderer().setSeriesPaint(i, color); } } final ChartPanel chartPanel = ChartUtils.createPanel(chart, false); final DCPanel leftPanel = new DCPanel(); leftPanel.setLayout(new VerticalLayout()); leftPanel.add(WidgetUtils.decorateWithShadow(chartPanel)); _backButton.setMargin(new Insets(0, 0, 0, 0)); _backButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { drillToOverview(result); } }); _rightPanel.setLayout(new VerticalLayout()); _rightPanel.add(_backButton); _rightPanel.add(WidgetUtils.decorateWithShadow(_table.toPanel())); final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.setOpaque(false); split.add(leftPanel); split.add(_rightPanel); split.setDividerLocation(550); return split; }
From source file:dnd.BasicDnD.java
public BasicDnD() { super(new BorderLayout()); JPanel leftPanel = createVerticalBoxPanel(); JPanel rightPanel = createVerticalBoxPanel(); //Create a table model. DefaultTableModel tm = new DefaultTableModel(); tm.addColumn("Column 0"); tm.addColumn("Column 1"); tm.addColumn("Column 2"); tm.addColumn("Column 3"); tm.addRow(new String[] { "Table 00", "Table 01", "Table 02", "Table 03" }); tm.addRow(new String[] { "Table 10", "Table 11", "Table 12", "Table 13" }); tm.addRow(new String[] { "Table 20", "Table 21", "Table 22", "Table 23" }); tm.addRow(new String[] { "Table 30", "Table 31", "Table 32", "Table 33" }); //LEFT COLUMN //Use the table model to create a table. table = new JTable(tm); leftPanel.add(createPanelForComponent(table, "JTable")); //Create a color chooser. colorChooser = new JColorChooser(); leftPanel.add(createPanelForComponent(colorChooser, "JColorChooser")); //RIGHT COLUMN //Create a textfield. textField = new JTextField(30); textField.setText("Favorite foods:\nPizza, Moussaka, Pot roast"); rightPanel.add(createPanelForComponent(textField, "JTextField")); //Create a scrolled text area. textArea = new JTextArea(5, 30); textArea.setText("Favorite shows:\nBuffy, Alias, Angel"); JScrollPane scrollPane = new JScrollPane(textArea); rightPanel.add(createPanelForComponent(scrollPane, "JTextArea")); //Create a list model and a list. DefaultListModel listModel = new DefaultListModel(); listModel.addElement("Martha Washington"); listModel.addElement("Abigail Adams"); listModel.addElement("Martha Randolph"); listModel.addElement("Dolley Madison"); listModel.addElement("Elizabeth Monroe"); listModel.addElement("Louisa Adams"); listModel.addElement("Emily Donelson"); list = new JList(listModel); list.setVisibleRowCount(-1);//www . j a v a2s.c om list.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.setTransferHandler(new TransferHandler() { public boolean canImport(TransferHandler.TransferSupport info) { // we only import Strings if (!info.isDataFlavorSupported(DataFlavor.stringFlavor)) { return false; } JList.DropLocation dl = (JList.DropLocation) info.getDropLocation(); if (dl.getIndex() == -1) { return false; } return true; } public boolean importData(TransferHandler.TransferSupport info) { if (!info.isDrop()) { return false; } // Check for String flavor if (!info.isDataFlavorSupported(DataFlavor.stringFlavor)) { displayDropLocation("List doesn't accept a drop of this type."); return false; } JList.DropLocation dl = (JList.DropLocation) info.getDropLocation(); DefaultListModel listModel = (DefaultListModel) list.getModel(); int index = dl.getIndex(); boolean insert = dl.isInsert(); // Get the current string under the drop. String value = (String) listModel.getElementAt(index); // Get the string that is being dropped. Transferable t = info.getTransferable(); String data; try { data = (String) t.getTransferData(DataFlavor.stringFlavor); } catch (Exception e) { return false; } // Display a dialog with the drop information. String dropValue = "\"" + data + "\" dropped "; if (dl.isInsert()) { if (dl.getIndex() == 0) { displayDropLocation(dropValue + "at beginning of list"); } else if (dl.getIndex() >= list.getModel().getSize()) { displayDropLocation(dropValue + "at end of list"); } else { String value1 = (String) list.getModel().getElementAt(dl.getIndex() - 1); String value2 = (String) list.getModel().getElementAt(dl.getIndex()); displayDropLocation(dropValue + "between \"" + value1 + "\" and \"" + value2 + "\""); } } else { displayDropLocation(dropValue + "on top of " + "\"" + value + "\""); } /** This is commented out for the basicdemo.html tutorial page. ** If you add this code snippet back and delete the ** "return false;" line, the list will accept drops ** of type string. // Perform the actual import. if (insert) { listModel.add(index, data); } else { listModel.set(index, data); } return true; */ return false; } public int getSourceActions(JComponent c) { return COPY; } protected Transferable createTransferable(JComponent c) { JList list = (JList) c; Object[] values = list.getSelectedValues(); StringBuffer buff = new StringBuffer(); for (int i = 0; i < values.length; i++) { Object val = values[i]; buff.append(val == null ? "" : val.toString()); if (i != values.length - 1) { buff.append("\n"); } } return new StringSelection(buff.toString()); } }); list.setDropMode(DropMode.ON_OR_INSERT); JScrollPane listView = new JScrollPane(list); listView.setPreferredSize(new Dimension(300, 100)); rightPanel.add(createPanelForComponent(listView, "JList")); //Create a tree. DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Mia Familia"); DefaultMutableTreeNode sharon = new DefaultMutableTreeNode("Sharon"); rootNode.add(sharon); DefaultMutableTreeNode maya = new DefaultMutableTreeNode("Maya"); sharon.add(maya); DefaultMutableTreeNode anya = new DefaultMutableTreeNode("Anya"); sharon.add(anya); sharon.add(new DefaultMutableTreeNode("Bongo")); maya.add(new DefaultMutableTreeNode("Muffin")); anya.add(new DefaultMutableTreeNode("Winky")); DefaultTreeModel model = new DefaultTreeModel(rootNode); tree = new JTree(model); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); JScrollPane treeView = new JScrollPane(tree); treeView.setPreferredSize(new Dimension(300, 100)); rightPanel.add(createPanelForComponent(treeView, "JTree")); //Create the toggle button. toggleDnD = new JCheckBox("Turn on Drag and Drop"); toggleDnD.setActionCommand("toggleDnD"); toggleDnD.addActionListener(this); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel); splitPane.setOneTouchExpandable(true); add(splitPane, BorderLayout.CENTER); add(toggleDnD, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); }
From source file:edu.clemson.cs.nestbed.client.gui.ConfigManagerFrame.java
public ConfigManagerFrame(Testbed testbed, Project project, ProjectDeploymentConfiguration config) throws RemoteException, NotBoundException, MalformedURLException, ClassNotFoundException { super(testbed.getName() + " Deployment Configuration Manager"); this.testbed = testbed; this.project = project; this.config = config; lookupRemoteManagers();/*from w w w. jav a 2 s . c o m*/ // TODO: We need to deregister listeners programCompileManager.addRemoteObserver(new ProgramCompileObserver()); programManager.addRemoteObserver(new ProgramObserver()); progProfManager.addRemoteObserver(new ProgramProfilingSymbolObserver()); progProfMsgSymManager.addRemoteObserver(new ProgramProfilingMessageSymbolObserver()); createComponents(); programTree.addMouseListener(new ProgramTreeMouseListener()); programTree.setCellRenderer(new ProgramTreeCellRenderer()); programTree.setRootVisible(false); programTree.setShowsRootHandles(true); programTree.setDragEnabled(true); programTree.setTransferHandler(new ProgramTreeTransferHandler()); programTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); profilingSymbolTable.addMouseListener(new ProfilingSymbolTableMouseListener()); profilingSymbolTable.setModel(new ProfilingSymbolTableModel()); profilingSymbolTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); new DropTarget(profilingSymbolTable, DnDConstants.ACTION_COPY_OR_MOVE, new ProgramSymbolDropTarget(), true); profilingMsgTable.addMouseListener(new ProfilingMessageTableMouseListener()); profilingMsgTable.setModel(new ProfilingMessageSymbolTableModel()); profilingMsgTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); new DropTarget(profilingMsgTable, DnDConstants.ACTION_COPY_OR_MOVE, new ProgramMessageSymbolDropTarget(), true); setSize(WINDOW_WIDTH, WINDOW_HEIGHT); setJMenuBar(buildMenuBar()); Container c = getContentPane(); c.setLayout(new BorderLayout()); JSplitPane top = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, buildLeftPanel(), buildMoteGridPanel()); JSplitPane panel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, buildBottomPanel()); c.add(panel, BorderLayout.CENTER); }
From source file:edu.purdue.cc.bionet.ui.DistributionAnalysisDisplayPanel.java
/** * Creates a new view containing the specified experiments. * /* www . j a v a 2 s . co m*/ * @param experiments The experiments to display in this view. * @return A boolean indicating whether creating the view was successful. */ public boolean createView(Collection<Experiment> experiments) { this.experiments = experiments; this.molecules = new TreeSet<Molecule>(); this.samples = new TreeSet<Sample>(); for (Experiment e : experiments) { this.molecules.addAll(e.getMolecules()); this.samples.addAll(e.getSamples()); } SampleGroup sampleGroup = new SampleGroup(Settings.getLanguage().get("All Samples"), this.samples); ArrayList<SampleGroup> sampleGroups = new ArrayList<SampleGroup>(); sampleGroups.add(sampleGroup); Language language = Settings.getLanguage(); this.topPanel = new JPanel(new BorderLayout()); this.bottomPanel = new JPanel(new GridLayout(1, 1)); this.experimentGraphPanel = new JPanel(new GridLayout(1, 1)); this.selectorTree = new ExperimentSelectorTreePanel(experiments); this.mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); this.graphSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); JPanel topRightPanel = new JPanel(new BorderLayout()); topRightPanel.add(this.fitSelectorPanel, BorderLayout.NORTH); topRightPanel.add(new JPanel(), BorderLayout.CENTER); this.topPanel.add(topRightPanel, BorderLayout.EAST); this.topPanel.add(this.experimentGraphPanel, BorderLayout.CENTER); this.add(mainSplitPane, BorderLayout.CENTER); this.mainSplitPane.setLeftComponent(this.selectorTree); this.mainSplitPane.setDividerLocation(200); this.mainSplitPane.setRightComponent(this.graphSplitPane); this.graphSplitPane.setTopComponent(this.topPanel); this.graphSplitPane.setBottomComponent(this.bottomPanel); this.setSampleGroups(sampleGroups); this.addComponentListener(this); return true; }
From source file:com.opendoorlogistics.studio.appframe.AppFrame.java
public AppFrame(ActionFactory actionFactory, MenuFactory menuFactory, Image appIcon, AppPermissions permissions) {// w ww. ja v a 2 s. c om if (appIcon == null) { appIcon = Icons.loadFromStandardPath("App logo.png").getImage(); } if (permissions == null) { permissions = new AppPermissions() { @Override public boolean isScriptEditingAllowed() { return true; } @Override public boolean isScriptDirectoryLocked() { return false; } }; } this.appPermissions = permissions; // then create other objects which might use the components tables = new DatastoreTablesPanel(this); // create scripts panel after registering components scriptManager = new ScriptUIManagerImpl(this); File scriptDir; if (appPermissions.isScriptDirectoryLocked()) { scriptDir = new File(AppConstants.SCRIPTS_DIRECTORY).getAbsoluteFile(); } else { scriptDir = PreferencesManager.getSingleton().getScriptsDirectory(); } scriptsPanel = new ScriptsPanel(getApi(), scriptDir, scriptManager); // set my icon if (appIcon != null) { setIconImage(appIcon); } // create actions - this assumes that actions live for the lifetime of the app List<UIAction> fileActions = actionFactory.createFileActions(this); allActions.addAll(fileActions); List<UIAction> editActions = actionFactory.createEditActions(this); allActions.addAll(editActions); // create left-hand panel with scripts and tables splitterLeftSide = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tables, scriptsPanel); splitterLeftSide.setPreferredSize(new Dimension(200, splitterLeftSide.getPreferredSize().height)); splitterLeftSide.setResizeWeight(0.5); // split center part into tables/scripts browser on the left and desktop // pane on the right JPanel rightPane = new JPanel(); rightPane.setLayout(new BorderLayout()); rightPane.add(getDesktopPane(), BorderLayout.CENTER); rightPane.add(getWindowToolBar(), BorderLayout.SOUTH); splitterMain = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitterLeftSide, rightPane); getContentPane().add(splitterMain, BorderLayout.CENTER); // add toolbar initToolbar(actionFactory, fileActions, editActions); initMenus(actionFactory, menuFactory, fileActions, editActions); // control close operation to stop changed being lost setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { if (canCloseDatastore()) { dispose(); if (haltJVMOnDispose) { System.exit(0); } } } }); // add myself as a drop target for importing excels etc from file new DropTarget(this, new DropFileImporterListener(this)); setVisible(true); updateAppearance(); }
From source file:com.qspin.qtaste.ui.MainPanel.java
public void genUI() { try {//from w ww . java 2s . com getContentPane().setLayout(new BorderLayout()); // prepare the top panel that contains the following panes: // - logo // - ConfigInfopanel // - Current Date/time JPanel topanel = new JPanel(new BorderLayout()); JPanel center = new JPanel(new GridBagLayout()); ImageIcon topLeftLogo = ResourceManager.getInstance().getImageIcon("main/qspin"); JLabel iconlabel = new JLabel(topLeftLogo); mHeaderPanel = new ConfigInfoPanel(this); mTestCasePanel = new TestCasePane(this); mTestCampaignPanel = new TestCampaignMainPanel(this); mHeaderPanel.init(); GridBagLineAdder centeradder = new GridBagLineAdder(center); JLabel sep = new JLabel(" "); sep.setFont(ResourceManager.getInstance().getSmallFont()); sep.setUI(new FillLabelUI(ResourceManager.getInstance().getLightColor())); centeradder.setWeight(1.0f, 0.0f); centeradder.add(mHeaderPanel); // prepare the right panels containg the main information: // the right pane is selected through the tabbed pane: // - Test cases: management of test cases and test suites // - Test campaign: management of test campaigns // - Interactive: ability to invoke QTaste verbs one by one mRightPanels = new JPanel(new CardLayout()); mRightPanels.add(mTestCasePanel, "Test Cases"); mRightPanels.add(mTestCampaignPanel, "Test Campaign"); final TestCaseInteractivePanel testInterractivePanel = new TestCaseInteractivePanel(); mRightPanels.add(testInterractivePanel, "Interactive"); mTreeTabsPanel = new JTabbedPane(JTabbedPane.BOTTOM); mTreeTabsPanel.setPreferredSize(new Dimension(TREE_TABS_WIDTH, HEIGHT)); TestCaseTree tct = new TestCaseTree(mTestCasePanel); JScrollPane sp2 = new JScrollPane(tct); mTreeTabsPanel.addTab("Test Cases", sp2); // add tree view for test campaign definition com.qspin.qtaste.ui.testcampaign.TestCaseTree mtct = new com.qspin.qtaste.ui.testcampaign.TestCaseTree( mTestCampaignPanel.getTreeTable()); JScrollPane sp3 = new JScrollPane(mtct); mTreeTabsPanel.addTab("Test Campaign", sp3); genMenu(tct); // add another tab contain used for Interactive mode TestAPIDocsTree jInteractive = new TestAPIDocsTree(testInterractivePanel); JScrollPane spInter = new JScrollPane(jInteractive); mTreeTabsPanel.addTab("Interactive", spInter); // init will do the link between the tree view and the pane testInterractivePanel.init(); // Define the listener to display the pane depending on the selected tab mTreeTabsPanel.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { String componentName = mTreeTabsPanel.getTitleAt(mTreeTabsPanel.getSelectedIndex()); CardLayout rcl = (CardLayout) mRightPanels.getLayout(); rcl.show(mRightPanels, componentName); } }); mTestCampaignPanel.addTestCampaignActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getID() == TestCampaignMainPanel.RUN_ID) { if (e.getActionCommand().equals(TestCampaignMainPanel.STARTED_CMD)) { // open the tab test cases SwingUtilities.invokeLater(new Runnable() { public void run() { mTreeTabsPanel.setSelectedIndex(0); mTestCasePanel.setSelectedTab(TestCasePane.RESULTS_INDEX); } }); // update the buttons mTestCasePanel.setExecutingTestCampaign(true, ((TestCampaignMainPanel) e.getSource()).getExecutionThread()); mTestCasePanel.updateButtons(true); } else if (e.getActionCommand().equals(TestCampaignMainPanel.STOPPED_CMD)) { mTestCasePanel.setExecutingTestCampaign(false, null); mTestCasePanel.updateButtons(); } } } }); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mTreeTabsPanel, mRightPanels); splitPane.setDividerSize(4); GUIConfiguration guiConfiguration = GUIConfiguration.getInstance(); int mainHorizontalSplitDividerLocation = guiConfiguration .getInt(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY, 285); splitPane.setDividerLocation(mainHorizontalSplitDividerLocation); splitPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("dividerLocation")) { GUIConfiguration guiConfiguration = GUIConfiguration.getInstance(); if (evt.getSource() instanceof JSplitPane) { JSplitPane splitPane = (JSplitPane) evt.getSource(); guiConfiguration.setProperty(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY, splitPane.getDividerLocation()); try { guiConfiguration.save(); } catch (ConfigurationException ex) { logger.error("Error while saving GUI configuration: " + ex.getMessage()); } } } } }); topanel.add(iconlabel, BorderLayout.WEST); topanel.add(center); getContentPane().add(topanel, BorderLayout.NORTH); getContentPane().add(splitPane); this.pack(); this.setExtendedState(Frame.MAXIMIZED_BOTH); if (mTestSuiteDir != null) { DirectoryTestSuite testSuite = DirectoryTestSuite.createDirectoryTestSuite(mTestSuiteDir); if (testSuite != null) { testSuite.setExecutionLoops(mNumberLoops, mLoopsInHour); setTestSuite(testSuite.getName()); mTestCasePanel.runTestSuite(testSuite, false); } } setVisible(true); //treeTabs.setMinimumSize(new Dimension(100, this.HEIGHT)); } catch (Exception e) { logger.fatal(e); e.printStackTrace(); TestEngine.shutdown(); System.exit(1); } }