use of javax.swing.JSplitPane in project vcell by virtualcell.
the class ViewObservablesMapPanel method initialize.
private void initialize() {
try {
// --------------------------------------- the split panels
setName("ViewGeneratedSpeciesPanel");
setLayout(new BorderLayout());
JPanel topPanel = new JPanel();
topPanel.setLayout(new GridBagLayout());
JPanel bottomPanel = new JPanel();
bottomPanel.setLayout(new GridBagLayout());
JSplitPane splitPaneHorizontal = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPaneHorizontal.setDividerSize(10);
splitPaneHorizontal.setOneTouchExpandable(true);
splitPaneHorizontal.setDividerLocation(260);
splitPaneHorizontal.setResizeWeight(0.5);
splitPaneHorizontal.setTopComponent(topPanel);
splitPaneHorizontal.setBottomComponent(bottomPanel);
add(splitPaneHorizontal, BorderLayout.CENTER);
// ---------------------------------------- species shape panel
shapePanelSpecies = new LargeShapePanel() {
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (spls != null) {
spls.paintSelf(g);
}
}
@Override
public DisplayMode getDisplayMode() {
return DisplayMode.other;
}
@Override
public RuleAnalysisChanged hasStateChanged(String reactionRuleName, MolecularComponentPattern molecularComponentPattern) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleAnalysisChanged hasStateChanged(MolecularComponentPattern molecularComponentPattern) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleAnalysisChanged hasBondChanged(String reactionRuleName, MolecularComponentPattern molecularComponentPattern) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleAnalysisChanged hasBondChanged(MolecularComponentPattern molecularComponentPattern) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleAnalysisChanged hasNoMatch(String reactionRuleName, MolecularTypePattern mtp) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleAnalysisChanged hasNoMatch(MolecularTypePattern molecularTypePattern) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleParticipantSignature getSignature() {
return null;
}
@Override
public GroupingCriteria getCriteria() {
return null;
}
@Override
public boolean isViewSingleRow() {
return true;
}
};
shapePanelSpecies.setLayout(new GridBagLayout());
shapePanelSpecies.setBackground(Color.white);
// not really editable but we don't want the brown contours here
shapePanelSpecies.setEditable(true);
shapePanelSpecies.setShowMoleculeColor(true);
shapePanelSpecies.setShowNonTrivialOnly(true);
Border loweredBevelBorder = BorderFactory.createLoweredBevelBorder();
JScrollPane scrollPaneSpecies = new JScrollPane(shapePanelSpecies);
scrollPaneSpecies.setBorder(loweredBevelBorder);
scrollPaneSpecies.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPaneSpecies.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
JPanel optionsPanelSpecies = new JPanel();
optionsPanelSpecies.setLayout(new GridBagLayout());
getZoomSmallerButtonSpecies().setEnabled(true);
getZoomLargerButtonSpecies().setEnabled(true);
shapePanelSpecies.zoomSmaller();
shapePanelSpecies.zoomSmaller();
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.insets = new Insets(0, 0, 0, 10);
gbc.anchor = GridBagConstraints.WEST;
optionsPanelSpecies.add(getZoomLargerButtonSpecies(), gbc);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.insets = new Insets(2, 0, 4, 10);
gbc.anchor = GridBagConstraints.WEST;
optionsPanelSpecies.add(getZoomSmallerButtonSpecies(), gbc);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.weightx = 1;
// fake cell used for filling all the vertical empty space
gbc.weighty = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(4, 4, 4, 10);
optionsPanelSpecies.add(new JLabel(""), gbc);
JPanel containerOfScrollPanelSpecies = new JPanel();
containerOfScrollPanelSpecies.setLayout(new BorderLayout());
containerOfScrollPanelSpecies.add(optionsPanelSpecies, BorderLayout.WEST);
containerOfScrollPanelSpecies.add(scrollPaneSpecies, BorderLayout.CENTER);
Dimension dimS = new Dimension(500, 125);
// dimension of shape panel
containerOfScrollPanelSpecies.setPreferredSize(dimS);
containerOfScrollPanelSpecies.setMinimumSize(dimS);
containerOfScrollPanelSpecies.setMaximumSize(dimS);
shapePanelObservable = new LargeShapePanel() {
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
for (SpeciesPatternLargeShape sps : spsList) {
if (sps == null) {
continue;
}
sps.paintSelf(g);
}
}
@Override
public DisplayMode getDisplayMode() {
return DisplayMode.other;
}
@Override
public RuleAnalysisChanged hasStateChanged(String reactionRuleName, MolecularComponentPattern molecularComponentPattern) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleAnalysisChanged hasStateChanged(MolecularComponentPattern molecularComponentPattern) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleAnalysisChanged hasBondChanged(String reactionRuleName, MolecularComponentPattern molecularComponentPattern) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleAnalysisChanged hasBondChanged(MolecularComponentPattern molecularComponentPattern) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleAnalysisChanged hasNoMatch(String reactionRuleName, MolecularTypePattern mtp) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleAnalysisChanged hasNoMatch(MolecularTypePattern molecularTypePattern) {
return RuleAnalysisChanged.UNCHANGED;
}
@Override
public RuleParticipantSignature getSignature() {
return null;
}
@Override
public GroupingCriteria getCriteria() {
return null;
}
@Override
public boolean isViewSingleRow() {
return true;
}
};
//
DefaultScrollTableCellRenderer rbmSpeciesPatternCellRenderer = new DefaultScrollTableCellRenderer() {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (table.getModel() instanceof GeneratedSpeciesTableModel2) {
Object selectedObject = null;
if (table.getModel() == speciesTableModel) {
selectedObject = speciesTableModel.getValueAt(row);
}
if (selectedObject != null) {
if (selectedObject instanceof GeneratedSpeciesTableRow && value instanceof String) {
SpeciesPattern sp = ((GeneratedSpeciesTableRow) selectedObject).getSpecies().getSpeciesPattern();
String text = "<html>";
text += RbmTableRenderer.toHtml(sp, isSelected);
text += "</html>";
setText(text);
}
}
}
return this;
}
};
// shapePanelObservable.setLayout(null);
shapePanelObservable.setLayout(new GridBagLayout());
shapePanelObservable.setBackground(Color.white);
shapePanelObservable.setEditable(true);
shapePanelObservable.setShowMoleculeColor(true);
shapePanelObservable.setShowNonTrivialOnly(true);
JScrollPane scrollPaneObservable = new JScrollPane(shapePanelObservable);
scrollPaneObservable.setBorder(loweredBevelBorder);
scrollPaneObservable.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPaneObservable.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
JPanel optionsPanelObservable = new JPanel();
optionsPanelObservable.setLayout(new GridBagLayout());
getZoomSmallerButtonObservable().setEnabled(true);
getZoomLargerButtonObservable().setEnabled(true);
shapePanelObservable.zoomSmaller();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.insets = new Insets(0, 0, 0, 10);
gbc.anchor = GridBagConstraints.WEST;
optionsPanelObservable.add(getZoomLargerButtonObservable(), gbc);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.insets = new Insets(2, 0, 4, 10);
gbc.anchor = GridBagConstraints.WEST;
optionsPanelObservable.add(getZoomSmallerButtonObservable(), gbc);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.weightx = 1;
// fake cell used for filling all the vertical empty space
gbc.weighty = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(4, 4, 4, 10);
optionsPanelObservable.add(new JLabel(""), gbc);
JPanel containerOfScrollPanelObservable = new JPanel();
containerOfScrollPanelObservable.setLayout(new BorderLayout());
containerOfScrollPanelObservable.add(optionsPanelObservable, BorderLayout.WEST);
containerOfScrollPanelObservable.add(scrollPaneObservable, BorderLayout.CENTER);
Dimension dimO = new Dimension(500, 100);
// dimension of shape panel
containerOfScrollPanelObservable.setPreferredSize(dimO);
containerOfScrollPanelObservable.setMinimumSize(dimO);
containerOfScrollPanelObservable.setMaximumSize(dimO);
// -------------- connection between tables, table models, selection models, renderers, event handlers
speciesTable = new EditorScrollTable();
speciesTableModel = new GeneratedSpeciesTableModel2(speciesTable, owner);
speciesTable.setModel(speciesTableModel);
speciesTable.getSelectionModel().addListSelectionListener(eventHandlerS);
speciesTable.getModel().addTableModelListener(eventHandlerS);
observablesTable = new EditorScrollTable();
observablesTableModel = new ObservablesGroupTableModel(observablesTable, owner, speciesTableModel);
observablesTable.setModel(observablesTableModel);
observablesTable.getSelectionModel().addListSelectionListener(eventHandlerO);
observablesTable.getModel().addTableModelListener(eventHandlerO);
speciesTable.getColumnModel().getColumn(GeneratedSpeciesTableModel2.iColDefinition).setCellRenderer(rbmSpeciesPatternCellRenderer);
DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
rightRenderer.setHorizontalAlignment(JLabel.RIGHT);
// speciesTable.getColumnModel().getColumn(GeneratedSpeciesTableModel2.iColMultiplier).setCellRenderer(rightRenderer); // right align
// left column wide enough for title
speciesTable.getColumnModel().getColumn(GeneratedSpeciesTableModel2.iColMultiplier).setMaxWidth(70);
speciesTable.addMouseMotionListener(new // add toolTipText for each table cell
MouseMotionAdapter() {
public void mouseMoved(MouseEvent e) {
Point p = e.getPoint();
int row = speciesTable.rowAtPoint(p);
int column = speciesTable.columnAtPoint(p);
speciesTable.setToolTipText(String.valueOf(speciesTable.getValueAt(row, column)));
}
});
// ---------------------------------------------- top panel
int gridy = 0;
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.gridwidth = 8;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(4, 4, 4, 4);
observablesTable.setPreferredScrollableViewportSize(new Dimension(400, 200));
topPanel.add(observablesTable.getEnclosingScrollPane(), gbc);
gridy++;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.anchor = GridBagConstraints.LINE_END;
gbc.insets = new Insets(4, 4, 4, 4);
topPanel.add(new JLabel("Search "), gbc);
textFieldSearchObservables = new JTextField(70);
textFieldSearchObservables.addActionListener(eventHandlerO);
textFieldSearchObservables.getDocument().addDocumentListener(eventHandlerO);
textFieldSearchObservables.putClientProperty("JTextField.variant", "search");
gbc = new java.awt.GridBagConstraints();
gbc.weightx = 1.0;
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.gridwidth = 3;
gbc.anchor = GridBagConstraints.LINE_START;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(4, 0, 4, 4);
topPanel.add(textFieldSearchObservables, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 4;
gbc.gridy = gridy;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(4, 4, 4, 10);
topPanel.add(totalObservablesLabel, gbc);
gridy++;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
// gbc.weightx = 1.0;
gbc.gridwidth = 8;
gbc.anchor = GridBagConstraints.LINE_END;
gbc.fill = java.awt.GridBagConstraints.BOTH;
gbc.insets = new Insets(4, 4, 4, 4);
topPanel.add(containerOfScrollPanelObservable, gbc);
// -------------------------------------------- bottom panel
gridy = 0;
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.gridwidth = 8;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(4, 4, 4, 4);
speciesTable.setPreferredScrollableViewportSize(new Dimension(400, 200));
bottomPanel.add(speciesTable.getEnclosingScrollPane(), gbc);
gridy++;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.anchor = GridBagConstraints.LINE_END;
gbc.insets = new Insets(4, 4, 4, 4);
bottomPanel.add(new JLabel("Search "), gbc);
textFieldSearchSpecies = new JTextField(70);
textFieldSearchSpecies.addActionListener(eventHandlerS);
textFieldSearchSpecies.getDocument().addDocumentListener(eventHandlerS);
textFieldSearchSpecies.putClientProperty("JTextField.variant", "search");
gbc = new java.awt.GridBagConstraints();
gbc.weightx = 1.0;
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.gridwidth = 3;
gbc.anchor = GridBagConstraints.LINE_START;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(4, 0, 4, 4);
bottomPanel.add(textFieldSearchSpecies, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 4;
gbc.gridy = gridy;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(4, 4, 4, 10);
bottomPanel.add(totalSpeciesLabel, gbc);
gridy++;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
// gbc.weightx = 1.0;
gbc.gridwidth = 8;
gbc.anchor = GridBagConstraints.LINE_END;
gbc.fill = java.awt.GridBagConstraints.BOTH;
gbc.insets = new Insets(4, 4, 4, 4);
bottomPanel.add(containerOfScrollPanelSpecies, gbc);
// rendering the small shapes of the flattened species in the Depiction column of this viewer table)
// TODO: this renderer is almost identical with the one in BioModelEditorModelPanel (which paints the small shapes
// of a species context in the Depiction column of the species table)
DefaultScrollTableCellRenderer rbmSpeciesShapeDepictionCellRenderer = new DefaultScrollTableCellRenderer() {
SpeciesPatternSmallShape spss = null;
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (table.getModel() instanceof VCellSortTableModel<?>) {
Object selectedObject = null;
if (table.getModel() == speciesTableModel) {
selectedObject = speciesTableModel.getValueAt(row);
}
if (selectedObject != null) {
if (selectedObject instanceof GeneratedSpeciesTableRow) {
SpeciesContext sc = ((GeneratedSpeciesTableRow) selectedObject).getSpecies();
// sp cannot be null
SpeciesPattern sp = sc.getSpeciesPattern();
Graphics panelContext = table.getGraphics();
spss = new SpeciesPatternSmallShape(4, 2, sp, panelContext, sc, isSelected, issueManager);
}
} else {
spss = null;
}
}
setText("");
return this;
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (spss != null) {
spss.paintSelf(g);
}
}
};
speciesTable.getColumnModel().getColumn(GeneratedSpeciesTableModel2.iColDepiction).setCellRenderer(rbmSpeciesShapeDepictionCellRenderer);
speciesTable.getColumnModel().getColumn(GeneratedSpeciesTableModel2.iColDepiction).setPreferredWidth(400);
speciesTable.getColumnModel().getColumn(GeneratedSpeciesTableModel2.iColDepiction).setMinWidth(400);
speciesTable.getColumnModel().getColumn(GeneratedSpeciesTableModel2.iColDefinition).setPreferredWidth(30);
speciesTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
DefaultScrollTableCellRenderer rbmObservableShapeDepictionCellRenderer = new DefaultScrollTableCellRenderer() {
List<SpeciesPatternSmallShape> spssList = new ArrayList<SpeciesPatternSmallShape>();
SpeciesPatternSmallShape spss = null;
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (table.getModel() instanceof VCellSortTableModel<?>) {
Object selectedObject = null;
if (table.getModel() == observablesTableModel) {
selectedObject = observablesTableModel.getValueAt(row);
}
if (selectedObject != null && selectedObject instanceof ObservablesGroupTableRow) {
ObservablesGroupTableRow ogtr = ((ObservablesGroupTableRow) selectedObject);
String obsName = ogtr.getObservableGroupObject().getObservableGroupName();
RbmObservable observable = ogtr.getObservable(obsName);
Graphics panelContext = table.getGraphics();
int xPos = 4;
spssList.clear();
for (int i = 0; i < observable.getSpeciesPatternList().size(); i++) {
SpeciesPattern sp = observable.getSpeciesPatternList().get(i);
spss = new SpeciesPatternSmallShape(xPos, 2, sp, panelContext, observable, isSelected, issueManager);
xPos += spss.getWidth() + 6;
spssList.add(spss);
}
} else {
spssList.clear();
}
}
setText("");
return this;
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
for (SpeciesPatternSmallShape spss : spssList) {
if (spss == null) {
continue;
}
spss.paintSelf(g);
}
}
};
observablesTable.getColumnModel().getColumn(ObservablesGroupTableModel.iColDepiction).setCellRenderer(rbmObservableShapeDepictionCellRenderer);
observablesTable.getColumnModel().getColumn(ObservablesGroupTableModel.iColDepiction).setPreferredWidth(150);
observablesTable.getColumnModel().getColumn(ObservablesGroupTableModel.iColDepiction).setMinWidth(150);
observablesTable.getColumnModel().getColumn(ObservablesGroupTableModel.iColDefinition).setPreferredWidth(80);
observablesTable.getColumnModel().getColumn(ObservablesGroupTableModel.iColExpression).setPreferredWidth(100);
observablesTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
use of javax.swing.JSplitPane in project vcell by virtualcell.
the class CopasiOptimizationMethodsHelpPanel method initialize.
private void initialize() {
setLayout(new BorderLayout());
getHyperLinkLabels();
JScrollPane scrollContent = new JScrollPane(getContentPanel());
JScrollPane scrollMessage = new JScrollPane(getMessagePanel());
JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollContent, scrollMessage);
split.setDividerLocation(170);
split.setDividerSize(2);
this.add(split, BorderLayout.CENTER);
}
use of javax.swing.JSplitPane in project vcell by virtualcell.
the class BNGLDebugger method initialize.
@Deprecated
public void initialize() {
// -------------------------------------------------- bngl panel
JScrollPane bnglPanel = new JScrollPane();
bnglTextArea = new JTextArea();
bnglTextArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// bnglTextArea.setFont(new Font("monospaced", Font.PLAIN, 14));
lineNumberArea = new JTextArea("1");
lineNumberArea.setBackground(Color.LIGHT_GRAY);
lineNumberArea.setEditable(false);
lineNumberArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
bnglTextArea.getDocument().addDocumentListener(new DocumentListener() {
public String getNr() {
lines = 1;
int caretPosition = bnglTextArea.getDocument().getLength();
Element root = bnglTextArea.getDocument().getDefaultRootElement();
String nr = "1" + System.getProperty("line.separator");
for (int i = 2; i < root.getElementIndex(caretPosition) + 2; i++) {
nr += i + System.getProperty("line.separator");
lines++;
}
return nr;
}
@Override
public void changedUpdate(DocumentEvent de) {
int oldLines = lines;
String numbers = getNr();
if (oldLines != lines) {
lineNumberArea.setText(numbers);
}
lineNumberArea.getHighlighter().removeAllHighlights();
}
@Override
public void insertUpdate(DocumentEvent de) {
int oldLines = lines;
String numbers = getNr();
if (oldLines != lines) {
lineNumberArea.setText(numbers);
}
lineNumberArea.getHighlighter().removeAllHighlights();
}
@Override
public void removeUpdate(DocumentEvent de) {
int oldLines = lines;
String numbers = getNr();
if (oldLines != lines) {
lineNumberArea.setText(numbers);
}
lineNumberArea.getHighlighter().removeAllHighlights();
}
});
bnglPanel.getViewport().add(bnglTextArea);
bnglPanel.setRowHeaderView(lineNumberArea);
bnglPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
JPanel upperPanel = new JPanel();
upperPanel.setLayout(new BorderLayout());
upperPanel.add(bnglPanel, BorderLayout.CENTER);
// ---------------------------------------------------- exception panel
JScrollPane exceptionPanel = new JScrollPane();
exceptionTextArea = new JTextArea();
exceptionTextArea.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
exceptionTextArea.setFont(new Font("monospaced", Font.PLAIN, 14));
exceptionPanel.getViewport().add(exceptionTextArea);
exceptionPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
JPanel lowerPanel = new JPanel();
lowerPanel.setLayout(new BorderLayout());
lowerPanel.add(exceptionPanel, BorderLayout.CENTER);
// ---------------------------------------------------- all together now :)
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(350);
splitPane.setResizeWeight(0.9);
splitPane.setTopComponent(upperPanel);
splitPane.setBottomComponent(lowerPanel);
// ... Create menubar
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = menuBar.add(new JMenu("File"));
// fileMenu.setMnemonic('F');
// fileMenu.add(openAction); // Note use of actions, not text.
// fileMenu.add(saveAction);
// fileMenu.addSeparator();
fileMenu.add(exitAction);
JPanel buttonPane = new JPanel();
buttonParse.addActionListener(this);
buttonSave.addActionListener(this);
buttonExit.addActionListener(this);
buttonPane.add(buttonParse);
buttonPane.add(buttonSave);
buttonPane.add(buttonExit);
JPanel framePanel = new JPanel();
framePanel.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.fill = GridBagConstraints.BOTH;
framePanel.add(splitPane, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weightx = 0;
gbc.weighty = 0;
gbc.gridwidth = GridBagConstraints.REMAINDER;
framePanel.add(buttonPane, gbc);
frame.add(framePanel);
frame.setJMenuBar(menuBar);
frame.pack();
frame.setName("BnglDebugger");
frame.setSize(900, 650);
frame.setVisible(true);
}
use of javax.swing.JSplitPane in project vcell by virtualcell.
the class BNGLDebuggerPanel method initialize.
private void initialize() {
getBnglPanel().getTextPane().setFont(new Font("monospaced", Font.PLAIN, 12));
getBnglPanel().getLineNumberPanel().setForeground(java.awt.Color.gray);
getBnglPanel().getLineNumberPanel().setBackground(java.awt.Color.white);
JPanel upperPanel = new JPanel();
upperPanel.setLayout(new BorderLayout());
upperPanel.add(getBnglPanel(), BorderLayout.CENTER);
JScrollPane exceptionPanel = new JScrollPane();
exceptionTextArea = new JTextPane();
exceptionTextArea.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
exceptionTextArea.setContentType("text/html");
// Font f = new Font("monospaced", Font.PLAIN, 10);
// exceptionTextArea.setFont(f);
exceptionPanel.getViewport().add(exceptionTextArea);
exceptionPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
JPanel lowerPanel = new JPanel();
lowerPanel.setLayout(new BorderLayout());
lowerPanel.add(exceptionPanel, BorderLayout.CENTER);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(350);
splitPane.setResizeWeight(0.9);
splitPane.setTopComponent(upperPanel);
splitPane.setBottomComponent(lowerPanel);
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.fill = GridBagConstraints.BOTH;
add(splitPane, gbc);
setPreferredSize(new Dimension(900, 650));
}
use of javax.swing.JSplitPane in project vcell by virtualcell.
the class VCellModelSelectionPanel method initializeComponents.
private void initializeComponents() {
setLayout(new BorderLayout());
listModel = new DefaultListModel<>();
list = new JList<>(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setCellRenderer(new DefaultListCellRenderer());
list.setFixedCellWidth(200);
JScrollPane leftScrollPane = new JScrollPane(list);
ImageIcon imageIcon = new ImageIcon();
imageLabel = new JLabel(imageIcon);
imageScrollPane = new JScrollPane(imageLabel);
imageScrollPane.setMinimumSize(new Dimension(0, 200));
parameterListPanel = new ModelParameterListPanel();
parameterListPanel.setPreferredSize(new Dimension(-1, 200));
JScrollPane parameterScrollPane = new JScrollPane(parameterListPanel);
parameterScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, imageScrollPane, parameterScrollPane);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftScrollPane, verticalSplitPane);
verticalSplitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, event -> {
displayImageOfSelectedModel();
});
add(splitPane, BorderLayout.CENTER);
list.addListSelectionListener(e -> {
if (!e.getValueIsAdjusting()) {
selectedModel = list.getSelectedValue();
displayImageOfSelectedModel();
parameterListPanel.setModel(selectedModel);
}
});
}
Aggregations