List of usage examples for javax.swing JSplitPane setRightComponent
@BeanProperty(bound = false, preferred = true, description = "The component to the right (or below) the divider.") public void setRightComponent(Component comp)
From source file:hu.bme.mit.sette.snippetbrowser.SnippetBrowser.java
/** * Initialise the contents of the frame. *///from ww w .jav a2 s . c o m private void initialize() { setTitle("Snippet Browser"); this.setBounds(50, 50, 1000, 600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSplitPane splitPane = new JSplitPane(); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPane.setResizeWeight(0.3); getContentPane().add(splitPane, BorderLayout.CENTER); JScrollPane scrollPaneLeft = new JScrollPane(); splitPane.setLeftComponent(scrollPaneLeft); treeSnippets = new JTree(); scrollPaneLeft.setViewportView(treeSnippets); JScrollPane scrollPaneRight = new JScrollPane(); splitPane.setRightComponent(scrollPaneRight); txtrInfo = new JTextArea(); txtrInfo.setEditable(false); scrollPaneRight.setViewportView(txtrInfo); }
From source file:gui.QTLResultsPanel.java
/** QTLResultsPanel(). * // w w w . jav a 2s. c om * @param qtlResult = the QTL results to show. * @param order = the ordered result data this QTL was created from. */ public QTLResultsPanel(QTLResult qtlResult, OrderedResult order) { this.qtlResult = qtlResult; this.order = order; // Trait listbox traitModel = new DefaultListModel<Trait>(); for (Trait trait : qtlResult.getTraits()) { traitModel.addElement(trait); } traitList = new JList<Trait>(traitModel); traitList.addListSelectionListener(this); traitList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane sp1 = new JScrollPane(traitList); sp1.setPreferredSize(new Dimension(125, 50)); // Details text box details = new JTextArea(); details.setFont(new Font("Monospaced", Font.PLAIN, 11)); details.setMargin(new Insets(2, 5, 2, 5)); details.setEditable(false); details.setTabSize(6); JScrollPane sp4; if (AppFrame.tpmmode == AppFrame.TPMMODE_QTL) { simpleDetails = new JScrollPane(); simpleDetails.setFont(new Font("Monospaced", Font.PLAIN, 11)); simplesplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); simpleright = new JTextArea(); simpleright.setFont(new Font("Monospaced", Font.PLAIN, 11)); simpleright.setMargin(new Insets(2, 5, 2, 5)); simpleright.setEditable(false); simpleright.setTabSize(6); simplesplit.setRightComponent(new JScrollPane(simpleright)); simplesplit.setLeftComponent(simpleDetails); sp4 = new JScrollPane(simplesplit); } else { // TPM MODE NONSNP simpleright = new JTextArea(); simpleright.setFont(new Font("Monospaced", Font.PLAIN, 11)); simpleright.setMargin(new Insets(2, 5, 2, 5)); simpleright.setEditable(false); sp4 = new JScrollPane(simpleright); } lodDetails = new JTextArea(); lodDetails.setFont(new Font("Monospaced", Font.PLAIN, 11)); lodDetails.setMargin(new Insets(2, 5, 2, 5)); lodDetails.setEditable(false); lodDetails.setTabSize(6); JScrollPane sp3 = new JScrollPane(lodDetails); JTabbedPane tabs = new JTabbedPane(); JScrollPane sp2 = new JScrollPane(details); tabs.add(sp2, "Full Model"); tabs.add(sp4, "Simple Model"); tabs.add(sp3, "LOD Details"); // The splitpane splits = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splits.setTopComponent(new JPanel()); splits.setBottomComponent(tabs); splits.setResizeWeight(0.5); // pane2 JSplitPane splits2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splits2.setLeftComponent(sp1); splits2.setRightComponent(splits); setLayout(new BorderLayout()); add(new GradientPanel("QTL Analysis Results"), BorderLayout.NORTH); // add(sp1, BorderLayout.WEST); // add(splits); add(splits2); add(toolbar = new QTLResultsToolBar(this), BorderLayout.EAST); }
From source file:com.orthancserver.SelectImageDialog.java
public SelectImageDialog() { tree_ = new JTree(); tree_.addTreeWillExpandListener(new TreeWillExpandListener() { @Override//from w w w .j a v a2 s.c o m public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException { TreePath path = event.getPath(); if (path.getLastPathComponent() instanceof MyTreeNode) { MyTreeNode node = (MyTreeNode) path.getLastPathComponent(); node.LoadChildren((DefaultTreeModel) tree_.getModel()); } } @Override public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException { } }); tree_.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getNewLeadSelectionPath(); if (path != null) { MyTreeNode node = (MyTreeNode) path.getLastPathComponent(); if (node.UpdatePreview(preview_)) { selectedType_ = node.GetResourceType(); selectedUuid_ = node.GetUuid(); selectedConnection_ = node.GetConnection(); okButton_.setEnabled(true); } removeServer_.setEnabled(node.GetResourceType() == ResourceType.SERVER); } } }); tree_.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { TreePath path = tree_.getPathForLocation(e.getX(), e.getY()); if (path != null) { MyTreeNode node = (MyTreeNode) path.getLastPathComponent(); if (e.getClickCount() == 2 && node.GetResourceType() == ResourceType.INSTANCE) { // Double click on an instance, close the dialog isSuccess_ = true; setVisible(false); } } } }); final JPanel contentPanel = new JPanel(); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); { JSplitPane splitPane = new JSplitPane(); splitPane.setResizeWeight(0.6); contentPanel.add(splitPane); splitPane.setLeftComponent(new JScrollPane(tree_)); splitPane.setRightComponent(preview_); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton btnAddServer = new JButton("Add server"); btnAddServer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { OrthancConfigurationDialog dd = new OrthancConfigurationDialog(); dd.setLocationRelativeTo(null); // Center dialog on screen OrthancConnection orthanc = dd.ShowModal(); if (orthanc != null) { AddOrthancServer(orthanc); ((DefaultTreeModel) tree_.getModel()).reload(); } } }); buttonPane.add(btnAddServer); } { buttonPane.add(removeServer_); removeServer_.setEnabled(false); removeServer_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { MyTreeNode selected = (MyTreeNode) tree_.getLastSelectedPathComponent(); if (selected.GetResourceType() == ResourceType.SERVER && JOptionPane.showConfirmDialog(null, "Remove server \"" + selected.getUserObject() + "\"?", "WARNING", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { ((DefaultTreeModel) tree_.getModel()).removeNodeFromParent(selected); } } }); } { okButton_.setEnabled(false); okButton_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { isSuccess_ = true; setVisible(false); } }); buttonPane.add(okButton_); getRootPane().setDefaultButton(okButton_); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { setVisible(false); } }); buttonPane.add(cancelButton); } } setUndecorated(false); setSize(500, 500); setTitle("Select some series or some instance in Orthanc"); setModal(true); }
From source file:net.sf.nmedit.nomad.core.Nomad.java
void setupUI() { this.clipBoard = new Clipboard("nomad clipboard"); ApplicationClipboard.setApplicationClipboard(clipBoard); mainWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { Nomad.sharedInstance().handleExit(); }//from w w w. j av a 2 s .co m }); pageContainer = new DefaultDocumentManager(); Container contentPane = mainWindow.getContentPane(); explorerTree = new FileExplorerTree(); explorerTree.setFont(new Font("Arial", Font.PLAIN, 11)); explorerTree.createPopup(menuBuilder); JScrollPane explorerTreeScroller = new JScrollPane(explorerTree); toolPane = new JTabbedPane2(); toolPane.setCloseActionEnabled(false); toolPane.addTab("Explorer", getImage("/icons/eview16/filenav_nav.gif"), explorerTreeScroller); new DropTarget(contentPane, new URIListDropHandler() { public void uriListDropped(URI[] uriList) { for (URI uri : uriList) { try { File f = new File(uri); openOrSelect(f); } catch (IllegalArgumentException e) { // ignore } } } }); synthPane = new JTabbedPane2(); synthPane.setCloseActionEnabled(true); JSplitPane sidebarSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false); sidebarSplit.setTopComponent(toolPane); sidebarSplit.setBottomComponent(synthPane); sidebarSplit.setResizeWeight(0.8); sidebarSplit.setOneTouchExpandable(true); /* JComponent sidebar = new JPanel(new BorderLayout()); sidebar.setBorder(null); sidebar.add(sidebarSplit, BorderLayout.CENTER); */ if (!Platform.isFlavor(OS.MacOSFlavor)) { /* JToolBar tb = createQuickActionToolbar(); sidebar.add(tb, BorderLayout.NORTH);*/ } else { registerForMacOSXEvents(); } JSplitPane splitLR = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitLR.setResizeWeight(0); splitLR.setDividerLocation(200); splitLR.setRightComponent(pageContainer); splitLR.setLeftComponent(sidebarSplit); contentPane.setLayout(new BorderLayout()); contentPane.add(splitLR, BorderLayout.CENTER); if (contentPane instanceof JComponent) ((JComponent) contentPane).revalidate(); }
From source file:com.ixora.rms.ui.RMSFrame.java
/** * Resets the current view.//from w ww. j a v a 2 s. c o m * * @return true if the current view vetoed the close request */ protected boolean resetCurrentView() { boolean veto = super.resetCurrentView(); if (veto) { return true; } JSplitPane p = getJSplitPane(); p.setLeftComponent(null); p.setEnabled(false); p.setRightComponent(getJDesktopPane()); setTitle(MessageRepository.get(Msg.TITLE_FRAME_RMS)); fDirtySession = false; return false; }
From source file:com.sri.ai.praise.demo.ChurchPanel.java
private void initialize() { setLayout(new BorderLayout(0, 0)); JPanel rootPanel = new JPanel(); add(rootPanel, BorderLayout.CENTER); rootPanel.setLayout(new BorderLayout(0, 0)); JSplitPane splitPane = new JSplitPane(); splitPane.setContinuousLayout(true); splitPane.setResizeWeight(0.5);/*from w ww.ja v a 2 s. c om*/ splitPane.setOneTouchExpandable(true); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); rootPanel.add(splitPane, BorderLayout.CENTER); JPanel churchPanel = new JPanel(); churchPanel.setLayout(new BorderLayout(0, 0)); JLabel lblNewLabel = new JLabel("Church Program"); churchPanel.add(lblNewLabel, BorderLayout.NORTH); churchEditor = new ChurchEditor(); churchPanel.add(churchEditor, BorderLayout.CENTER); splitPane.setLeftComponent(churchPanel); JPanel hogmPanel = new JPanel(); hogmPanel.setLayout(new BorderLayout(0, 0)); JLabel lblNewLabel_1 = new JLabel("Generated Model (Read Only)"); hogmPanel.add(lblNewLabel_1, BorderLayout.NORTH); hogmEditor = new RuleEditor(); hogmEditor.setEditable(false); hogmPanel.add(hogmEditor, BorderLayout.CENTER); splitPane.setRightComponent(hogmPanel); }
From source file:org.jfree.chart.demo.SuperDemo.java
private JComponent createContent() { JPanel jpanel = new JPanel(new BorderLayout()); JTabbedPane jtabbedpane = new JTabbedPane(); JPanel jpanel1 = new JPanel(new BorderLayout()); jpanel1.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); JSplitPane jsplitpane = new JSplitPane(1); JTree jtree = new JTree(createTreeModel()); jtree.addTreeSelectionListener(this); JScrollPane jscrollpane = new JScrollPane(jtree); jscrollpane.setPreferredSize(new Dimension(300, 100)); jsplitpane.setLeftComponent(jscrollpane); jsplitpane.setRightComponent(createChartDisplayPanel()); jpanel1.add(jsplitpane);/*from ww w . jav a2s.c o m*/ jtabbedpane.add("Demos", jpanel1); MemoryUsageDemo memoryusagedemo = new MemoryUsageDemo(0x493e0); (memoryusagedemo.new DataGenerator(1000)).start();//memoryusagedemo, jtabbedpane.add("Memory Usage", memoryusagedemo); jtabbedpane.add("Source Code", createSourceCodePanel()); jtabbedpane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); jpanel.add(jtabbedpane); return jpanel; }
From source file:com.igormaznitsa.sciareto.ui.MainFrame.java
public MainFrame(@Nonnull @MustNotContainNull final String... args) { super();/*from w w w. ja va2 s . c o m*/ initComponents(); this.stackPanel = new JPanel(); this.stackPanel.setFocusable(false); this.stackPanel.setOpaque(false); this.stackPanel.setBorder(BorderFactory.createEmptyBorder(32, 32, 16, 32)); this.stackPanel.setLayout(new BoxLayout(this.stackPanel, BoxLayout.Y_AXIS)); final JPanel glassPanel = (JPanel) this.getGlassPane(); glassPanel.setOpaque(false); this.setGlassPane(glassPanel); glassPanel.setLayout(new BorderLayout(8, 8)); glassPanel.add(Box.createGlue(), BorderLayout.CENTER); final JPanel ppanel = new JPanel(new BorderLayout(0, 0)); ppanel.setFocusable(false); ppanel.setOpaque(false); ppanel.setCursor(null); ppanel.add(this.stackPanel, BorderLayout.SOUTH); glassPanel.add(ppanel, BorderLayout.EAST); this.stackPanel.add(Box.createGlue()); glassPanel.setVisible(false); this.setTitle("Scia Reto"); setIconImage(UiUtils.loadImage("logo256x256.png")); this.stateless = args.length > 0; final MainFrame theInstance = this; this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(@Nonnull final WindowEvent e) { if (doClosing()) { dispose(); } } }); this.tabPane = new EditorTabPane(this); this.explorerTree = new ExplorerTree(this); final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(250); splitPane.setResizeWeight(0.0d); splitPane.setLeftComponent(this.explorerTree); splitPane.setRightComponent(this.tabPane); add(splitPane, BorderLayout.CENTER); this.menuOpenRecentProject.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { final File[] lastOpenedProjects = FileHistoryManager.getInstance().getLastOpenedProjects(); if (lastOpenedProjects.length > 0) { for (final File folder : lastOpenedProjects) { final JMenuItem item = new JMenuItem(folder.getName()); item.setToolTipText(folder.getAbsolutePath()); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openProject(folder, false); } }); menuOpenRecentProject.add(item); } } } @Override public void menuDeselected(MenuEvent e) { menuOpenRecentProject.removeAll(); } @Override public void menuCanceled(MenuEvent e) { } }); this.menuOpenRecentFile.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { final File[] lastOpenedFiles = FileHistoryManager.getInstance().getLastOpenedFiles(); if (lastOpenedFiles.length > 0) { for (final File file : lastOpenedFiles) { final JMenuItem item = new JMenuItem(file.getName()); item.setToolTipText(file.getAbsolutePath()); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openFileAsTab(file); } }); menuOpenRecentFile.add(item); } } } @Override public void menuDeselected(MenuEvent e) { menuOpenRecentFile.removeAll(); } @Override public void menuCanceled(MenuEvent e) { } }); if (!this.stateless) { restoreState(); } else { boolean openedProject = false; for (final String filePath : args) { final File file = new File(filePath); if (file.isDirectory()) { openedProject = true; openProject(file, true); } else if (file.isFile()) { openFileAsTab(file); } } if (!openedProject) { //TODO try to hide project panel! } } final LookAndFeel current = UIManager.getLookAndFeel(); final ButtonGroup lfGroup = new ButtonGroup(); final String currentLFClassName = current.getClass().getName(); for (final UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { final JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(info.getName()); lfGroup.add(menuItem); if (currentLFClassName.equals(info.getClassName())) { menuItem.setSelected(true); } menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(@Nonnull final ActionEvent e) { try { UIManager.setLookAndFeel(info.getClassName()); SwingUtilities.updateComponentTreeUI(theInstance); PreferencesManager.getInstance().getPreferences().put(Main.PROPERTY_LOOKANDFEEL, info.getClassName()); PreferencesManager.getInstance().flush(); } catch (Exception ex) { LOGGER.error("Can't change LF", ex); } } }); this.menuLookAndFeel.add(menuItem); } }
From source file:ca.phon.app.project.ProjectWindow.java
private void init() { /* Layout *//*from w w w . java 2 s . c o m*/ setLayout(new BorderLayout()); final ProjectDataTransferHandler transferHandler = new ProjectDataTransferHandler(this); /* Create components */ newCorpusButton = createNewCorpusButton(); createCorpusButton = createCorpusButton(); corpusList = new JList<String>(); corpusModel = new CorpusListModel(getProject()); corpusList.setModel(corpusModel); corpusList.setCellRenderer(new CorpusListCellRenderer()); corpusList.setVisibleRowCount(20); corpusList.addListSelectionListener(e -> { if (getSelectedCorpus() != null) { String corpus = getSelectedCorpus(); sessionModel.setCorpus(corpus); sessionList.clearSelection(); corpusDetails.setCorpus(corpus); if (getProject().getCorpusSessions(corpus).size() == 0) { onSwapNewAndCreateSession(newSessionButton); } else { onSwapNewAndCreateSession(createSessionButton); } } }); corpusList.addMouseListener(new MouseInputAdapter() { @Override public void mousePressed(MouseEvent e) { doPopup(e); } @Override public void mouseReleased(MouseEvent e) { doPopup(e); } public void doPopup(MouseEvent e) { if (e.isPopupTrigger()) { int clickedIdx = corpusList.locationToIndex(e.getPoint()); if (clickedIdx >= 0 && Arrays.binarySearch(corpusList.getSelectedIndices(), clickedIdx) < 0) { corpusList.setSelectedIndex(clickedIdx); } showCorpusListContextMenu(e.getPoint()); } } }); final DragSource corpusDragSource = new DragSource(); corpusDragSource.createDefaultDragGestureRecognizer(corpusList, DnDConstants.ACTION_COPY, (event) -> { final List<ProjectPath> paths = new ArrayList<>(); for (String corpus : getSelectedCorpora()) { final ProjectPath corpusPath = new ProjectPath(getProject(), corpus, null); paths.add(corpusPath); } final ProjectPathTransferable transferable = new ProjectPathTransferable(paths); event.startDrag(DragSource.DefaultCopyDrop, transferable); }); corpusList.setDragEnabled(true); corpusList.setTransferHandler(transferHandler); corpusDetails = new CorpusDetailsPane(getProject()); corpusDetails.setWrapStyleWord(true); corpusDetails.setRows(6); corpusDetails.setLineWrap(true); corpusDetails.setBackground(Color.white); corpusDetails.setOpaque(true); JScrollPane corpusDetailsScroller = new JScrollPane(corpusDetails); sessionList = new JList<String>(); newSessionButton = createNewSessionButton(); createSessionButton = createSessionButton(); sessionModel = new SessionListModel(getProject()); sessionList.setModel(sessionModel); sessionList.setCellRenderer(new SessionListCellRenderer()); sessionList.setVisibleRowCount(20); sessionList.addListSelectionListener(e -> { if (sessionList.getSelectedValue() != null && !e.getValueIsAdjusting()) { String corpus = getSelectedCorpus(); String session = getSelectedSessionName(); sessionDetails.setSession(corpus, session); } }); sessionList.addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2 && e.getButton() == 1) { // get the clicked item int clickedItem = sessionList.locationToIndex(e.getPoint()); if (sessionList.getModel().getElementAt(clickedItem) == null) return; final String session = sessionList.getModel().getElementAt(clickedItem).toString(); final String corpus = ((SessionListModel) sessionList.getModel()).getCorpus(); msgPanel.reset(); msgPanel.setMessageLabel("Opening '" + corpus + "." + session + "'"); msgPanel.setIndeterminate(true); msgPanel.repaint(); SwingUtilities.invokeLater(() -> { final ActionEvent ae = new ActionEvent(sessionList, -1, "openSession"); (new OpenSessionAction(ProjectWindow.this, corpus, session)).actionPerformed(ae); msgPanel.setIndeterminate(false); }); } } @Override public void mousePressed(MouseEvent e) { doPopup(e); } @Override public void mouseReleased(MouseEvent e) { doPopup(e); } public void doPopup(MouseEvent e) { if (e.isPopupTrigger()) { int clickedIdx = sessionList.locationToIndex(e.getPoint()); if (clickedIdx >= 0 && Arrays.binarySearch(sessionList.getSelectedIndices(), clickedIdx) < 0) { sessionList.setSelectedIndex(clickedIdx); } showSessionListContextMenu(e.getPoint()); } } }); sessionList.setDragEnabled(true); sessionList.setTransferHandler(transferHandler); final DragSource sessionDragSource = new DragSource(); sessionDragSource.createDefaultDragGestureRecognizer(sessionList, DnDConstants.ACTION_COPY, (event) -> { final List<ProjectPath> paths = new ArrayList<>(); final String corpus = getSelectedCorpus(); if (corpus == null) return; for (String session : getSelectedSessionNames()) { final ProjectPath sessionPath = new ProjectPath(getProject(), corpus, session); paths.add(sessionPath); } final ProjectPathTransferable transferable = new ProjectPathTransferable(paths); event.startDrag(DragSource.DefaultCopyDrop, transferable); }); sessionDetails = new SessionDetailsPane(getProject()); sessionDetails.setLineWrap(true); sessionDetails.setRows(6); sessionDetails.setWrapStyleWord(true); sessionDetails.setBackground(Color.white); sessionDetails.setOpaque(true); JScrollPane sessionDetailsScroller = new JScrollPane(sessionDetails); JScrollPane corpusScroller = new JScrollPane(corpusList); JScrollPane sessionScroller = new JScrollPane(sessionList); blindModeBox = new JCheckBox("Blind transcription"); blindModeBox.setSelected(false); msgPanel = new StatusPanel(); corpusPanel = new JPanel(new BorderLayout()); corpusPanel.add(newCorpusButton, BorderLayout.NORTH); corpusPanel.add(corpusScroller, BorderLayout.CENTER); corpusPanel.add(corpusDetailsScroller, BorderLayout.SOUTH); sessionPanel = new JPanel(new BorderLayout()); sessionPanel.add(newSessionButton, BorderLayout.NORTH); sessionPanel.add(sessionScroller, BorderLayout.CENTER); sessionPanel.add(sessionDetailsScroller, BorderLayout.SOUTH); final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPane.setLeftComponent(corpusPanel); splitPane.setRightComponent(sessionPanel); splitPane.setResizeWeight(0.5); // invoke later SwingUtilities.invokeLater(() -> { splitPane.setDividerLocation(0.5); }); // the frame layout String projectName = null; projectName = getProject().getName(); DialogHeader header = new DialogHeader(projectName, StringUtils.abbreviate(projectLoadPath, 80)); add(header, BorderLayout.NORTH); CellConstraints cc = new CellConstraints(); final JPanel topPanel = new JPanel(new FormLayout("pref, fill:pref:grow, right:pref", "pref")); topPanel.add(msgPanel, cc.xy(1, 1)); topPanel.add(blindModeBox, cc.xy(3, 1)); add(splitPane, BorderLayout.CENTER); add(topPanel, BorderLayout.SOUTH); // if no corpora are currently available, 'prompt' the user to create a new one if (getProject().getCorpora().size() == 0) { SwingUtilities.invokeLater(() -> { onSwapNewAndCreateCorpus(newCorpusButton); }); } else { SwingUtilities.invokeLater(() -> { corpusList.setSelectedIndex(0); }); } }
From source file:be.fedict.eid.tsl.tool.TslInternalFrame.java
private void addServiceProviderTab(JTabbedPane tabbedPane) { JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); tabbedPane.add("Service Providers", splitPane); DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Service Providers"); this.tree = new JTree(rootNode); this.tree.addTreeSelectionListener(this); for (TrustServiceProvider trustServiceProvider : this.trustServiceList.getTrustServiceProviders()) { DefaultMutableTreeNode trustServiceProviderNode = new DefaultMutableTreeNode( trustServiceProvider.getName()); rootNode.add(trustServiceProviderNode); for (TrustService trustService : trustServiceProvider.getTrustServices()) { MutableTreeNode trustServiceNode = new DefaultMutableTreeNode(trustService); trustServiceProviderNode.add(trustServiceNode); }/*ww w .ja va 2s .co m*/ } this.tree.expandRow(0); JScrollPane treeScrollPane = new JScrollPane(this.tree); JPanel detailsPanel = new JPanel(); splitPane.setLeftComponent(treeScrollPane); splitPane.setRightComponent(detailsPanel); initDetailsPanel(detailsPanel); }