List of usage examples for javax.swing JSplitPane setResizeWeight
@BeanProperty(description = "Specifies how to distribute extra space when the split pane resizes.") public void setResizeWeight(double value)
From source file:com.igormaznitsa.sciareto.ui.MainFrame.java
public MainFrame(@Nonnull @MustNotContainNull final String... args) { super();/*from w w w . j a v a 2 s . co 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:com.vgi.mafscaling.LogView.java
private void createDataTab() { JPanel dataPanel = new JPanel(new BorderLayout()); add(dataPanel, "<html><div style='text-align: center;'>D<br>a<br>t<br>a</div></html>"); createToolBar(dataPanel);//from w w w. j av a 2 s .c o m createLogViewPanel(); createGraghPanel(); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, logViewPanel, chartPanel); splitPane.setResizeWeight(0.5); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); splitPane.setDividerLocation(150); dataPanel.add(splitPane); }
From source file:com.intuit.tank.tools.debugger.AgentDebuggerFrame.java
/** * @throws HeadlessException/*from www . ja v a 2s . c o m*/ */ public AgentDebuggerFrame(final boolean isStandalone, String serviceUrl) throws HeadlessException { super("Intuit Tank Agent Debugger"); workingDir = PanelBuilder.createWorkingDir(this, serviceUrl); setSize(new Dimension(1024, 800)); setBounds(new Rectangle(getSize())); setPreferredSize(getSize()); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setLayout(new BorderLayout()); this.standalone = isStandalone; addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent e) { quit(); } }); errorIcon = ActionProducer.getIcon("bullet_error.png", IconSize.SMALL); modifiedIcon = ActionProducer.getIcon("bullet_code_change.png", IconSize.SMALL); skippedIcon = ActionProducer.getIcon("skip.png", IconSize.SMALL); this.glassPane = new InfiniteProgressPanel(); setGlassPane(glassPane); debuggerActions = new ActionProducer(this, serviceUrl); requestResponsePanel = new RequestResponsePanel(this); requestResponsePanel.init(); testPlanChooser = new JComboBox(); testPlanChooser.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent event) { if (event.getItem() != null) { HDTestPlan selected = (HDTestPlan) event.getItem(); if (!selected.equals(currentTestPlan)) { setCurrentTestPlan(selected); } } } }); tankClientChooser = new JComboBox<TankClientChoice>(); debuggerActions.setChoiceComboBoxOptions(tankClientChooser); actionComponents = new ActionComponents(standalone, testPlanChooser, tankClientChooser, debuggerActions); addScriptChangedListener(actionComponents); setJMenuBar(actionComponents.getMenuBar()); Component topPanel = PanelBuilder.createTopPanel(actionComponents); Component bottomPanel = PanelBuilder.createBottomPanel(this); Component contentPanel = PanelBuilder.createContentPanel(this); final JPopupMenu popup = actionComponents.getPopupMenu(); scriptEditorTA.setPopupMenu(null); scriptEditorTA.addMouseListener(new MouseAdapter() { int lastHash; @Override public void mousePressed(MouseEvent e) { maybeShow(e); } @Override public void mouseReleased(MouseEvent e) { maybeShow(e); } private void maybeShow(MouseEvent e) { if (lastHash == getHash(e)) { return; } if (e.isPopupTrigger()) { // select the line try { int offset = scriptEditorTA.viewToModel(e.getPoint()); Rectangle modelToView = scriptEditorTA.modelToView(offset); Point point = new Point(modelToView.x + 1, e.getPoint().y); if (modelToView.contains(point)) { if (!multiSelect) { int line = scriptEditorTA.getLineOfOffset(offset); scriptEditorTA.setCurrentLine(line); } popup.show(e.getComponent(), e.getX(), e.getY()); } } catch (BadLocationException e1) { e1.printStackTrace(); } } else if (e.isShiftDown()) { int line = scriptEditorTA.getCaretLineNumber(); int start = Math.min(line, lastLine); int end = Math.max(line, lastLine); multiSelect = end - start > 1; if (multiSelect) { multiSelectStart = start; multiSelectEnd = end; try { scriptEditorTA.setEnabled(true); scriptEditorTA.select(scriptEditorTA.getLineStartOffset(start), scriptEditorTA.getLineEndOffset(end)); scriptEditorTA.setEnabled(false); } catch (BadLocationException e1) { e1.printStackTrace(); multiSelect = false; } } } else { multiSelect = false; lastLine = scriptEditorTA.getCaretLineNumber(); } lastHash = getHash(e); } private int getHash(MouseEvent e) { return new HashCodeBuilder().append(e.getButton()).append(e.getSource().hashCode()) .append(e.getPoint()).toHashCode(); } }); JSplitPane mainSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); mainSplit.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); mainSplit.setTopComponent(contentPanel); mainSplit.setBottomComponent(bottomPanel); mainSplit.setDividerLocation(600); mainSplit.setResizeWeight(0.8D); mainSplit.setDividerSize(5); add(topPanel, BorderLayout.NORTH); add(mainSplit, BorderLayout.CENTER); WindowUtil.centerOnScreen(this); pack(); KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); manager.addKeyEventDispatcher(new KeyEventDispatcher() { @Override public boolean dispatchKeyEvent(KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED) { handleKeyEvent(e); } return false; } }); }
From source file:ca.phon.app.project.ProjectWindow.java
private void init() { /* Layout */// ww w.j ava 2s. 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:com.diversityarrays.kdxplore.trials.TrialViewPanel.java
public TrialViewPanel(WindowOpener<JFrame> windowOpener, OfflineData od, Transformer<Trial, Boolean> checkIfEditorActive, Consumer<Trial> onTraitInstancesRemoved, MessagePrinter mp) {/* www. ja va 2s .co m*/ super(new BorderLayout()); this.windowOpener = windowOpener; this.checkIfEditorActive = checkIfEditorActive; this.onTraitInstancesRemoved = onTraitInstancesRemoved; this.messagePrinter = mp; this.offlineData = od; this.offlineData.addOfflineDataChangeListener(offlineDataChangeListener); KdxploreDatabase db = offlineData.getKdxploreDatabase(); if (db != null) { db.addEntityChangeListener(trialChangeListener); } trialDataTable.setTransferHandler(TableTransferHandler.initialiseForCopySelectAll(trialDataTable, true)); trialPropertiesTable .setTransferHandler(TableTransferHandler.initialiseForCopySelectAll(trialPropertiesTable, true)); // Note: Can't use renderers because the TM always returns String.class // for getColumnClass() // trialPropertiesTable.setDefaultRenderer(TrialLayout.class, new // TrialLayoutRenderer(trialPropertiesTableModel)); // trialPropertiesTable.setDefaultRenderer(PlotIdentOption.class, new // PlotIdentOptionRenderer(trialPropertiesTableModel)); trialPropertiesTableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { if (trialPropertiesTableModel.getRowCount() > 0) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GuiUtil.initialiseTableColumnWidths(trialPropertiesTable); } }); trialPropertiesTableModel.removeTableModelListener(this); } } }); // int tnsColumnIndex = -1; // for (int col = trialPropertiesTableModel.getColumnCount(); --col >= 0; ) { // if (TraitNameStyle.class == trialPropertiesTableModel.getColumnClass(col)) { // tnsColumnIndex = col; // break; // } // } editAction.setEnabled(false); trialPropertiesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int vrow = trialPropertiesTable.getSelectedRow(); editAction.setEnabled(vrow >= 0 && trialPropertiesTableModel.isCellEditable(vrow, 1)); } } }); errorMessage.setForeground(Color.RED); Box top = Box.createHorizontalBox(); top.add(errorMessage); top.add(Box.createHorizontalGlue()); top.add(new JButton(editAction)); JPanel main = new JPanel(new BorderLayout()); main.add(new JScrollPane(trialPropertiesTable), BorderLayout.CENTER); main.add(legendPanel, BorderLayout.SOUTH); JScrollPane trialDataTableScrollPane = new JScrollPane(trialDataTable); // The preferred height of the viewport is determined // by whether or not we need to use hh:mm:ss in the name of any of // the scoring data sets. JViewport viewPort = new JViewport() { @Override public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.height = 32; TableModel model = trialDataTable.getModel(); if (model instanceof TrialData) { if (((TrialData) model).isUsingHMSformat()) { d.height = 48; } } return d; } }; trialDataTableScrollPane.setColumnHeader(viewPort); JTableHeader th = trialDataTable.getTableHeader(); th.setDefaultRenderer(trialDataTableHeaderRenderer); th.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int column = th.columnAtPoint(e.getPoint()); trialDataTableHeaderRenderer.columnSelected = column; boolean shifted = 0 != (MouseEvent.SHIFT_MASK & e.getModifiers()); boolean right = SwingUtilities.isRightMouseButton(e); updateDeleteSamplesAction(shifted, right); e.consume(); } }); trialDataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { removeTraitInstancesAction.setEnabled(trialDataTable.getSelectedRowCount() > 0); } } }); removeTraitInstancesAction.setEnabled(false); KDClientUtils.initAction(ImageId.PLUS_BLUE_24, addSampleGroupAction, Msg.TOOLTIP_ADD_SAMPLES_FOR_SCORING()); KDClientUtils.initAction(ImageId.TRASH_24, deleteSamplesAction, Msg.TOOLTIP_DELETE_COLLECTED_SAMPLES()); KDClientUtils.initAction(ImageId.EXPORT_24, exportSamplesAction, Msg.TOOLTIP_EXPORT_SAMPLES_OR_TRAITS()); KDClientUtils.initAction(ImageId.MINUS_GOLD_24, removeTraitInstancesAction, Msg.TOOLTIP_REMOVE_TRAIT_INSTANCES_WITH_NO_DATA()); JPanel trialDataPanel = new JPanel(new BorderLayout()); Box buttons = Box.createHorizontalBox(); buttons.add(new JButton(removeTraitInstancesAction)); buttons.add(Box.createHorizontalGlue()); buttons.add(new JButton(exportSamplesAction)); buttons.add(Box.createHorizontalGlue()); buttons.add(new JButton(addSampleGroupAction)); buttons.add(Box.createHorizontalStrut(8)); buttons.add(new JButton(deleteSamplesAction)); trialDataPanel.add(GuiUtil.createLabelSeparator("Measurements by Source", buttons), BorderLayout.NORTH); trialDataPanel.add(trialDataTableScrollPane, BorderLayout.CENTER); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, main, trialDataPanel); splitPane.setResizeWeight(0.5); add(top, BorderLayout.NORTH); add(splitPane, BorderLayout.CENTER); trialDataTable.setDefaultRenderer(Object.class, new TrialDataCellRenderer()); trialDataTable.addPropertyChangeListener("model", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { trialDataTableHeaderRenderer.columnSelected = -1; updateDeleteSamplesAction(false, false); } }); }
From source file:com.codeasylum.stress.ui.Jormungandr.java
private synchronized Jormungandr init() throws IOException, SAXException, ParserConfigurationException { TestPlan testPlan;/*w w w. j av a 2 s . co m*/ GhostPanel ghostPanel; GroupLayout groupLayout; ViewPanel viewPanel; JTree testTree; JSplitPane workSplitPane; JScrollPane paletteScrollPane; JScrollPane testScrollPane; setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); exchangeTransport = new ExchangeTransportImpl(exchangeTransportRMIPort); menuHandler = new JormungandrMenuHandler(this, menuDelegateFactory); testExecutor = new TestExecutor(testPlan = new TestPlan(), exchangeTransport); testExecutor.addTestExecutorListener(this); testPlan.getRootTask().setName(palette.getAvatar(RootTask.class).getName()); setGlassPane(ghostPanel = new GhostPanel()); setLayout(groupLayout = new GroupLayout(getContentPane())); testTree = new JTree(); palettePanel = new PalettePanel(this, ghostPanel, palette); testPanel = new TestPanel(this, ghostPanel, palette, viewPanel = new ViewPanel(testTree), testTree); paletteScrollPane = new JScrollPane(palettePanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); testScrollPane = new JScrollPane(testPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); workSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, testScrollPane, viewPanel); workSplitPane.setDoubleBuffered(true); workSplitPane.setContinuousLayout(true); workSplitPane.setResizeWeight(0.3); groupLayout.setAutoCreateContainerGaps(true); groupLayout.setHorizontalGroup(groupLayout.createSequentialGroup() .addComponent(paletteScrollPane, (int) palettePanel.getMinimumSize().getWidth() + 3, (int) palettePanel.getPreferredSize().getWidth() + 3, (int) palettePanel.getMaximumSize().getWidth() + 3) .addComponent(workSplitPane)); groupLayout.setVerticalGroup(groupLayout.createParallelGroup() .addComponent(paletteScrollPane, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(workSplitPane, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); setSize(new Dimension(Math.max(800, ((int) getLayout().preferredLayoutSize(this).getWidth()) + 120), Math.min(600, ((int) getLayout().preferredLayoutSize(this).getHeight()) + 38))); setLocationByPlatform(true); addWindowListener(this); return this; }
From source file:com.diversityarrays.kdxplore.trialmgr.trait.TraitExplorerPanel.java
public TraitExplorerPanel(MessagePrinter mp, OfflineData od, DALClientProvider clientProvider, // KdxUploadHandler uploadHandler, BackgroundRunner backgroundRunner, ImageIcon addBarcodeIcon, Transformer<Trial, Boolean> checkIfEditorActive) { super(new BorderLayout()); this.backgroundRunner = backgroundRunner; this.clientProvider = clientProvider; // this.uploadHandler = uploadHandler; this.messagePrinter = mp; this.offlineData = od; this.checkIfEditorActive = checkIfEditorActive; offlineData.addOfflineDataChangeListener(offlineDataListener); editingLocked.setIcon(KDClientUtils.getIcon(ImageId.LOCKED)); editingLocked.addActionListener(new ActionListener() { @Override//from w w w. j a v a2 s . c om public void actionPerformed(ActionEvent e) { changeEditable(editingLocked.isSelected(), DONT_OVERRIDE); } }); changeManager.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { updateUndoRedoActions(); } }); KDClientUtils.initAction(ImageId.TRASH_24, deleteTraitsAction, "Remove Trait"); deleteTraitsAction.setEnabled(false); KDClientUtils.initAction(ImageId.REFRESH_24, refreshAction, "Refresh Data"); KDClientUtils.initAction(ImageId.PLUS_BLUE_24, addNewTraitAction, "Add Trait"); KDClientUtils.initAction(ImageId.UPLOAD_24, uploadTraitsAction, "Upload Traits"); KDClientUtils.initAction(ImageId.ADD_TRIALS_24, importTraitsAction, "Import Traits"); KDClientUtils.initAction(ImageId.EXPORT_24, exportTraitsAction, "Export Traits"); try { Class.forName("com.diversityarrays.kdxplore.upload.TraitUploadTask"); } catch (ClassNotFoundException e1) { uploadTraitsAction.setEnabled(false); if (RunMode.getRunMode().isDeveloper()) { new Toast((JComponent) null, "<HTML>Developer Warning<BR>" + "Trait Upload currently unavailable<BR>", 4000) .showAsError(); } } traitPropertiesTable .setTransferHandler(TableTransferHandler.initialiseForCopySelectAll(traitPropertiesTable, true)); traitPropertiesTableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { if (traitPropertiesTableModel.getRowCount() > 0) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GuiUtil.initialiseTableColumnWidths(traitPropertiesTable); } }); traitPropertiesTableModel.removeTableModelListener(this); } } }); traitTableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { showCorrectCard(); } }); TrialManagerPreferences preferences = TrialManagerPreferences.getInstance(); preferences.addChangeListener(TrialManagerPreferences.BAD_FOR_CALC, badForCalcColorChangeListener); badForCalc.setForeground(preferences.getBadForCalcColor()); badForCalc.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { KdxPreference<Color> pref = TrialManagerPreferences.BAD_FOR_CALC; String title = pref.getName(); KdxplorePreferenceEditor.startEditorDialog(TraitExplorerPanel.this, title, pref); } } }); traitsTable.setAutoCreateRowSorter(true); int index = traitTableModel.getTraitNameColumnIndex(); if (index >= 0) { traitsTable.getColumnModel().getColumn(index).setCellRenderer(traitNameCellRenderer); } traitsTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && 2 == e.getClickCount()) { e.consume(); int vrow = traitsTable.rowAtPoint(e.getPoint()); if (vrow >= 0) { int mrow = traitsTable.convertRowIndexToModel(vrow); if (mrow >= 0) { Trait trait = traitTableModel.getTraitAtRow(mrow); Integer selectViewRow = null; if (!traitTrialsTableModel.isSelectedTrait(trait)) { selectViewRow = vrow; } if (traitsEditable) { startEditingTraitInternal(trait, selectViewRow, null); } else { warnEditingLocked(); } } } } } }); traitsTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); traitsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { List<Trait> selectedTraits = getSelectedTraits(); traitTrialsTableModel.setSelectedTraits(selectedTraits); if (selectedTraits.size() == 1) { Trait trait = null; int vrow = traitsTable.getSelectedRow(); if (vrow >= 0) { int mrow = traitsTable.convertRowIndexToModel(vrow); if (mrow >= 0) { trait = traitTableModel.getEntityAt(mrow); } } showTraitDetails(trait); } deleteTraitsAction.setEnabled(selectedTraits.size() > 0); showCorrectCard(); } } }); TraitTableModel.initValidationExpressionRenderer(traitsTable); if (RunMode.getRunMode().isDeveloper()) { TraitTableModel.initTableForRawExpression(traitsTable); } cardPanel.add(noTraitsComponent, CARD_NO_TRAITS); cardPanel.add(selectTraitComponent, CARD_SELECT_TO_EDIT); cardPanel.add(new JScrollPane(traitPropertiesTable), CARD_TRAIT_EDITOR); JButton undoButton = initAction(undoAction, ImageId.UNDO_24, "Undo", KeyStroke.getKeyStroke('Z', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); JButton redoButton = initAction(redoAction, ImageId.REDO_24, "Redo", KeyStroke.getKeyStroke('Y', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); Box undoRedoButtons = Box.createHorizontalBox(); undoRedoButtons.add(undoButton); undoRedoButtons.add(redoButton); JPanel detailsPanel = new JPanel(new BorderLayout()); detailsPanel.add(GuiUtil.createLabelSeparator("Details", undoRedoButtons), BorderLayout.NORTH); detailsPanel.add(cardPanel, BorderLayout.CENTER); detailsPanel.add(legendPanel, BorderLayout.SOUTH); PromptScrollPane scrollPane = new PromptScrollPane(traitsTable, "Drag/Drop Traits CSV file or use 'Import Traits'"); TableTransferHandler tth = TableTransferHandler.initialiseForCopySelectAll(traitsTable, true); traitsTable.setTransferHandler(new ChainingTransferHandler(flth, tth)); scrollPane.setTransferHandler(flth); if (addBarcodeIcon == null) { barcodesMenuAction.putValue(Action.NAME, "Barcodes..."); } else { barcodesMenuAction.putValue(Action.SMALL_ICON, addBarcodeIcon); } italicsForProtectedCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { traitNameCellRenderer.setUseItalicsForProtected(italicsForProtectedCheckbox.isSelected()); traitsTable.repaint(); } }); Box leftTopControls = Box.createHorizontalBox(); leftTopControls.add(importTraitsButton); leftTopControls.add(barcodesMenuButton); leftTopControls.add(new JButton(addNewTraitAction)); leftTopControls.add(new JButton(uploadTraitsAction)); leftTopControls.add(new JButton(exportTraitsAction)); leftTopControls.add(Box.createHorizontalGlue()); leftTopControls.add(editingLocked); leftTopControls.add(fixTraitLevelsButton); leftTopControls.add(refreshButton); leftTopControls.add(Box.createHorizontalStrut(8)); leftTopControls.add(new JButton(deleteTraitsAction)); // leftTopControls.add(Box.createHorizontalStrut(4)); Box explanations = Box.createHorizontalBox(); explanations.add(italicsForProtectedCheckbox); explanations.add(badForCalc); explanations.add(Box.createHorizontalGlue()); fixTraitLevelsButton.setToolTipText("Fix Traits with " + TraitLevel.UNDECIDABLE.visible + " 'Level'"); fixTraitLevelsButton.setVisible(false); JPanel leftTop = new JPanel(new BorderLayout()); leftTop.add(leftTopControls, BorderLayout.NORTH); leftTop.add(scrollPane, BorderLayout.CENTER); leftTop.add(explanations, BorderLayout.SOUTH); JPanel leftBot = new JPanel(new BorderLayout()); leftBot.add(GuiUtil.createLabelSeparator("Used by Trials"), BorderLayout.NORTH); leftBot.add(new PromptScrollPane(traitTrialsTable, "Any Trials using selected Traits appear here")); JSplitPane leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, leftTop, leftBot); leftSplit.setResizeWeight(0.5); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSplit, detailsPanel); splitPane.setOneTouchExpandable(true); splitPane.setResizeWeight(0.5); add(splitPane, BorderLayout.CENTER); }
From source file:com.intuit.tank.tools.debugger.RequestResponsePanel.java
public void init() { JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true); pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); requestTA = new RTextArea(); requestTA.setEditable(false);/*w w w. ja va 2s . c om*/ requestTA.setAutoscrolls(true); requestTA.setHighlightCurrentLine(false); JScrollPane sp1 = new JScrollPane(requestTA, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp1.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); JPanel reqPane = new JPanel(new BorderLayout()); // JPanel titlePanel = new JPanel(new BorderLayout()); // titlePanel.add(BorderLayout.WEST, new JLabel("Request:")); // JButton saveBT = new JButton(parent.getDebuggerActions().getSaveReqResponseAction()); // saveBT.setText(""); // titlePanel.add(BorderLayout.EAST, saveBT); reqPane.add(BorderLayout.NORTH, new JLabel("Request:")); reqPane.add(BorderLayout.CENTER, sp1); pane.setTopComponent(reqPane); responseTA = new RTextArea(); responseTA.setEditable(false); responseTA.setAutoscrolls(true); responseTA.setHighlightCurrentLine(false); JScrollPane sp2 = new JScrollPane(responseTA, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp2.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); JPanel responsePane = new JPanel(new BorderLayout()); responsePane.add(BorderLayout.NORTH, new JLabel("Response:")); responsePane.add(BorderLayout.CENTER, sp2); pane.setBottomComponent(responsePane); pane.setDividerLocation(0.5D); pane.setResizeWeight(0.5D); add(pane, BorderLayout.CENTER); JPopupMenu popupMenu = new JPopupMenu(); popupMenu.add(parent.getDebuggerActions().getSaveReqResponseAction()); requestTA.setPopupMenu(popupMenu); responseTA.setPopupMenu(popupMenu); }
From source file:com.intuit.tank.tools.debugger.PanelBuilder.java
/** * @param debuggerActions/* w w w . j ava2 s . com*/ * @return */ static Component createContentPanel(final AgentDebuggerFrame frame) { JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true); pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); final RSyntaxTextArea scriptEditorTA = new RSyntaxTextArea(); frame.setScriptEditorTA(scriptEditorTA); scriptEditorTA.setSelectionColor(scriptEditorTA.getCurrentLineHighlightColor()); scriptEditorTA.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE); scriptEditorTA.setHyperlinksEnabled(false); scriptEditorTA.setEditable(false); scriptEditorTA.setEnabled(false); scriptEditorTA.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { scriptEditorTA.grabFocus(); try { int offs = scriptEditorTA.viewToModel(e.getPoint()); if (offs > -1) { int line = scriptEditorTA.getLineOfOffset(offs); if (frame.getSteps().size() > line) { frame.fireStepChanged(line); if (e.getClickCount() == 2 && !e.isPopupTrigger()) { // show step xml try { DebugStep debugStep = frame.getSteps().get(line); String text = JaxbUtil.marshall(debugStep.getStepRun()); StepDialog dlg = new StepDialog(frame, text, SyntaxConstants.SYNTAX_STYLE_XML); dlg.setVisible(true); } catch (JAXBException e1) { frame.showError("Error showing step xml: " + e); } } } } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } } }); RTextScrollPane scriptEditorScrollPane = new RTextScrollPane(scriptEditorTA); frame.setScriptEditorScrollPane(scriptEditorScrollPane); scriptEditorScrollPane.setIconRowHeaderEnabled(true); scriptEditorScrollPane.getGutter() .setBookmarkIcon(ActionProducer.getIcon("bullet_blue.png", IconSize.SMALL)); scriptEditorScrollPane.getGutter() .setCurrentLineIcon(ActionProducer.getIcon("current_line.png", IconSize.SMALL)); scriptEditorScrollPane.getGutter().setBookmarkingEnabled(true); pane.setLeftComponent(scriptEditorScrollPane); pane.setRightComponent(createRightPanel(frame)); pane.setDividerLocation(300); pane.setResizeWeight(0.4D); return pane; }
From source file:org.fhaes.jsea.JSEAFrame.java
/** * Setup the GUI components/* w w w. j ava 2 s.c o m*/ */ private void setupGui() { setTitle("jSEA - Superposed Epoch Analysis"); getContentPane().setLayout(new MigLayout("", "[1200px,grow,fill]", "[][600px,grow,fill]")); initActions(); setupMenu(); setupToolbar(); this.setIconImage(Builder.getApplicationIcon()); { JSplitPane splitPane = new JSplitPane(); splitPane.setOneTouchExpandable(true); getContentPane().add(splitPane, "cell 0 1,alignx left,aligny top"); splitPane.setLeftComponent(contentPanel); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPanel.setLayout(new MigLayout("", "[grow,fill]", "[78.00][][][grow][]")); { JPanel panel = new JPanel(); panel.setBorder( new TitledBorder(null, "Input Files", TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(panel, "cell 0 0,grow"); panel.setLayout(new MigLayout("", "[][][grow][]", "[][]")); { JLabel lblContinuousTimeSeries = new JLabel("Continuous time series file:"); panel.add(lblContinuousTimeSeries, "cell 0 0,alignx trailing"); } { HelpTipButton label = new HelpTipButton( "Continuous time series data files should be two column comma seperated (CSV) text files. Column one should contains the years (in sequence), and column two should contain the data values. If there are header lines or comments in the file, these lines should beginning with a *"); panel.add(label, "cell 1 0,alignx trailing"); } { txtTimeSeriesFile = new JTextField(); txtwrapper = new TextComponentWrapper(txtTimeSeriesFile, PrefKey.JSEA_CONTINUOUS_TIME_SERIES_FILE, ""); txtTimeSeriesFile.setEditable(true); panel.add(txtTimeSeriesFile, "cell 2 0,growx"); txtTimeSeriesFile.setColumns(10); } { btnTimeSeriesFile = new JButton(); btnTimeSeriesFile.setIcon(Builder.getImageIcon("fileopen16.png")); btnTimeSeriesFile.setActionCommand("TimeSeriesFileBrowse"); btnTimeSeriesFile.addActionListener(this); btnTimeSeriesFile.setPreferredSize(new Dimension(25, 25)); btnTimeSeriesFile.setMaximumSize(new Dimension(25, 25)); btnTimeSeriesFile.putClientProperty("JButton.buttonType", "segmentedTextured"); btnTimeSeriesFile.putClientProperty("JButton.segmentPosition", "middle"); panel.add(btnTimeSeriesFile, "cell 3 0"); } { JLabel lblEventListFile = new JLabel("Event list file:"); panel.add(lblEventListFile, "cell 0 1,alignx trailing"); } { HelpTipButton helpTipButton = new HelpTipButton( "Event data files should be a text file with a single column of integer year values. If there are any header or comment lines, these should begin with a *"); panel.add(helpTipButton, "cell 1 1,alignx trailing"); } { txtEventListFile = new JTextField(); new TextComponentWrapper(txtEventListFile, PrefKey.JSEA_EVENT_LIST_FILE, ""); txtEventListFile.setEditable(false); panel.add(txtEventListFile, "cell 2 1,growx"); txtEventListFile.setColumns(10); } { btnEventListFile = new JButton(); btnEventListFile.setIcon(Builder.getImageIcon("fileopen16.png")); btnEventListFile.setActionCommand("EventListFileBrowse"); btnEventListFile.addActionListener(this); btnEventListFile.setPreferredSize(new Dimension(25, 25)); btnEventListFile.setMaximumSize(new Dimension(25, 25)); btnEventListFile.putClientProperty("JButton.buttonType", "segmentedTextured"); btnEventListFile.putClientProperty("JButton.segmentPosition", "middle"); panel.add(btnEventListFile, "cell 3 1"); } } { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(null, "Window, Simulation and Statistics", TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(panel, "cell 0 1,grow"); panel.setLayout(new MigLayout("", "[right][][fill][10px:10px:10px][right][][90.00,grow,fill]", "[grow][][][]")); { JLabel lblYears = new JLabel("Years to analyse:"); panel.add(lblYears, "cell 0 0"); } { HelpTipButton helpTipButton = new HelpTipButton( "Specify which years from the dataset to analyse."); panel.add(helpTipButton, "cell 1 0"); } { JPanel panel_1 = new JPanel(); panel.add(panel_1, "cell 2 0 5 1,grow"); panel_1.setLayout(new MigLayout("fill, insets 0", "[80px:80px][][80px:80px,fill][grow]", "[]")); { spnFirstYear = new JSpinner(); spnFirstYear.setEnabled(false); panel_1.add(spnFirstYear, "cell 0 0,growx"); spnFirstYear.setModel(new SpinnerNumberModel(new Integer(0), null, null, new Integer(1))); spnFirstYear.setEditor(new JSpinner.NumberEditor(spnFirstYear, "#")); new SpinnerWrapper(spnFirstYear, PrefKey.JSEA_FIRST_YEAR, 0); } { JLabel lblTo = new JLabel("-"); panel_1.add(lblTo, "cell 1 0"); } { spnLastYear = new JSpinner(); spnLastYear.setEnabled(false); panel_1.add(spnLastYear, "cell 2 0"); spnLastYear.setModel(new SpinnerNumberModel(new Integer(2020), null, null, new Integer(1))); spnLastYear.setEditor(new JSpinner.NumberEditor(spnLastYear, "#")); new SpinnerWrapper(spnLastYear, PrefKey.JSEA_LAST_YEAR, 2020); } { chkAllYears = new JCheckBox("all years in series"); chkAllYears.setSelected(true); chkAllYears.setActionCommand("AllYearsCheckbox"); chkAllYears.addActionListener(this); panel_1.add(chkAllYears, "cell 3 0"); } } { JLabel lblLagsPriorTo = new JLabel("Lags prior to event:"); panel.add(lblLagsPriorTo, "cell 0 1"); } { HelpTipButton helpTipButton = new HelpTipButton(""); panel.add(helpTipButton, "cell 1 1"); } { spnLagsPrior = new JSpinner(); new SpinnerWrapper(spnLagsPrior, PrefKey.JSEA_LAGS_PRIOR_TO_EVENT, 6); panel.add(spnLagsPrior, "cell 2 1,growx"); // spnLagsPrior.setModel(new SpinnerNumberModel(6, 1, 100, 1)); spnLagsPrior.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { segmentationPanel.table.tableModel.clearSegments(); validateForm(); } }); } { JLabel lblSimulationsToRun = new JLabel("Simulations:"); panel.add(lblSimulationsToRun, "cell 4 1"); } { HelpTipButton helpTipButton = new HelpTipButton( "Number of simulations to run. Increasing the number of simulations increases the analysis time."); panel.add(helpTipButton, "cell 5 1"); } { spnSimulationsToRun = new JSpinner(); new SpinnerWrapper(spnSimulationsToRun, PrefKey.JSEA_SIMULATION_COUNT, 1000); panel.add(spnSimulationsToRun, "cell 6 1"); spnSimulationsToRun.setModel(new SpinnerNumberModel(1000, 1, 10096, 1)); } { JLabel lblLagsFollowingThe = new JLabel("Lags following the event:"); panel.add(lblLagsFollowingThe, "cell 0 2"); } { HelpTipButton helpTipButton = new HelpTipButton(""); panel.add(helpTipButton, "cell 1 2"); } { spnLagsAfter = new JSpinner(); new SpinnerWrapper(spnLagsAfter, PrefKey.JSEA_LAGS_AFTER_EVENT, 4); panel.add(spnLagsAfter, "cell 2 2,growx"); spnLagsAfter.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { segmentationPanel.table.tableModel.clearSegments(); validateForm(); } }); } { JLabel lblSeedNumber = new JLabel("Seed number:"); panel.add(lblSeedNumber, "cell 4 2"); } { HelpTipButton helpTipButton = new HelpTipButton( "The analysis requires a pseudo-random component which is seeded with the seed number (a large integer value). Running analyses with the same seed number enables produces the same results. You can leave the seed as the default number unless you specifically want to generate results from a different randomised pool."); panel.add(helpTipButton, "cell 5 2"); } { spnSeedNumber = new JSpinner(); new SpinnerWrapper(spnSeedNumber, PrefKey.JSEA_SEED_NUMBER, 30188); panel.add(spnSeedNumber, "cell 6 2"); spnSeedNumber.setModel(new SpinnerNumberModel(30188, 10000, 1000000, 1)); } { JLabel lblIncludeIncompleteWindow = new JLabel("Include incomplete epoch:"); panel.add(lblIncludeIncompleteWindow, "cell 0 3"); } { HelpTipButton helpTipButton = new HelpTipButton(""); panel.add(helpTipButton, "cell 1 3"); } { chkIncludeIncompleteWindow = new JCheckBox(""); new CheckBoxWrapper(chkIncludeIncompleteWindow, PrefKey.JSEA_INCLUDE_INCOMPLETE_WINDOW, false); panel.add(chkIncludeIncompleteWindow, "cell 2 3"); } { JLabel lblPvalue = new JLabel("p-value:"); panel.add(lblPvalue, "cell 4 3"); } { HelpTipButton helpTipButton = new HelpTipButton( "The cutoff value to use for statistical significance"); panel.add(helpTipButton, "cell 5 3,alignx trailing"); } { cbxPValue = new JComboBox(); panel.add(cbxPValue, "cell 6 3"); cbxPValue.setModel(new DefaultComboBoxModel(new Double[] { 0.05, 0.01, 0.001 })); } } { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(null, "Chart Options", TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(panel, "cell 0 2,grow"); panel.setLayout(new MigLayout("", "[right][][grow]", "[][]")); { JLabel lblTitleOfChart = new JLabel("Title of chart:"); panel.add(lblTitleOfChart, "cell 0 0,alignx trailing"); } { HelpTipButton helpTipButton = new HelpTipButton( "Title to use on the chart. The placeholder {segment} is replaced with the years of the segment being plotted."); panel.add(helpTipButton, "cell 1 0,alignx trailing"); } { txtChartTitle = new JTextField(); txtChartTitle.setToolTipText("<html>Title to be displayed on the<br/>" + "chart output"); new TextComponentWrapper(txtChartTitle, PrefKey.JSEA_CHART_TITLE, "Chart title {segment}"); panel.add(txtChartTitle, "cell 2 0,growx,aligny top"); txtChartTitle.setColumns(10); } { JLabel lblYaxisLabel = new JLabel("Continuous series (y-axis) label"); panel.add(lblYaxisLabel, "cell 0 1,alignx trailing"); } { txtYAxisLabel = new JTextField(); txtYAxisLabel .setToolTipText("<html>Label to be displayed on the<br/> " + "continuous series axis"); new TextComponentWrapper(txtYAxisLabel, PrefKey.JSEA_YAXIS_LABEL, "Y Axis"); panel.add(txtYAxisLabel, "cell 2 1,growx"); txtYAxisLabel.setColumns(10); } } { // Segmentation implementation used from FHSampleSize segmentationPanel = new SegmentationPanel(); segmentationPanel.chkSegmentation.setText("Process subset or segments of events?"); segmentationPanel.chkSegmentation.setActionCommand("SegmentationMode"); segmentationPanel.chkSegmentation.addActionListener(this); contentPanel.add(segmentationPanel, "cell 0 3,grow"); } { tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM); splitPane.setRightComponent(tabbedPane); { summaryPanel = new JPanel(); tabbedPane.addTab("Summary ", Builder.getImageIcon("info.png"), summaryPanel, null); summaryPanel.setLayout(new BorderLayout(0, 0)); { scrollPane = new JScrollPane(); summaryPanel.add(scrollPane); { txtSummary = new JTextArea(); txtSummary.setEditable(false); scrollPane.setViewportView(txtSummary); JMenuItem mntmCopy = new JMenuItem(actionCopy); JPopupMenu popup = new JPopupMenu(); addPopup(scrollPane, popup); popup.add(mntmCopy); } } } { dataPanel = new JPanel(); tabbedPane.addTab("Data ", Builder.getImageIcon("table.png"), dataPanel, null); dataPanel.setLayout(new MigLayout("", "[grow,fill]", "[grow]")); { JSplitPane splitPaneDataTables = new JSplitPane(); splitPaneDataTables.setResizeWeight(0.5); splitPaneDataTables.setOneTouchExpandable(true); splitPaneDataTables.setOrientation(JSplitPane.VERTICAL_SPLIT); dataPanel.add(splitPaneDataTables, "cell 0 0,grow"); { JPanel panel = new JPanel(); splitPaneDataTables.setLeftComponent(panel); panel.setBorder(new TitledBorder(null, "Actual key events", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setLayout(new MigLayout("", "[227.00px,grow,fill]", "[68.00px,grow,fill]")); { JScrollPane scrollPane = new JScrollPane(); panel.add(scrollPane, "cell 0 0,grow"); { tblActual = new JXTable(); adapterActualTable = new JTableSpreadsheetByRowAdapter(tblActual); scrollPane.setViewportView(tblActual); tblActual.setSortable(false); JMenuItem mntmCopy = new JMenuItem(actionCopy); JPopupMenu popup = new JPopupMenu(); addPopup(tblActual, popup); popup.add(mntmCopy); } } } { JPanel panel = new JPanel(); splitPaneDataTables.setRightComponent(panel); panel.setBorder(new TitledBorder(null, "Simulation results", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setLayout(new MigLayout("", "[grow,fill]", "[grow,fill]")); { JScrollPane scrollPane = new JScrollPane(); panel.add(scrollPane, "cell 0 0,grow"); { tblSimulation = new JXTable(); adapterSimulationTable = new JTableSpreadsheetByRowAdapter(tblSimulation); scrollPane.setViewportView(tblSimulation); tblSimulation.setSortable(false); JMenuItem mntmCopy = new JMenuItem(actionCopy); JPopupMenu popup = new JPopupMenu(); addPopup(tblSimulation, popup); popup.add(mntmCopy); } } } splitPaneDataTables.setDividerLocation(0.5f); } } { chartPanel = new JPanel(); tabbedPane.addTab("Chart ", Builder.getImageIcon("barchart.png"), chartPanel, null); chartPanel.setLayout(new MigLayout("", "[][grow]", "[][grow]")); { segmentComboBox = new JComboBox(); segmentComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent arg0) { if (segmentComboBox.getItemCount() > 0) { barChart = new JSEABarChart( jsea.getChartList().get(segmentComboBox.getSelectedIndex())); barChart.setMaximumDrawHeight(MAX_DRAW_HEIGHT); barChart.setMaximumDrawWidth(MAX_DRAW_WIDTH); chartPanel.removeAll(); chartPanel.add(plotSegmentLabel, "cell 0 0,alignx center,aligny center"); chartPanel.add(segmentComboBox, "cell 1 0,growx,aligny center"); chartPanel.add(barChart, "cell 0 1 2 1,grow"); chartPanel.revalidate(); chartPanel.repaint(); } } }); { plotSegmentLabel = new JLabel("Plot Segment: "); chartPanel.add(plotSegmentLabel, "cell 0 0,alignx center,aligny center"); } chartPanel.add(segmentComboBox, "cell 1 0,growx,aligny center"); } } } } pack(); validateForm(); setAnalysisAvailable(false); setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); }