下面列出了javax.swing.JSplitPane#add ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public SqlViewer(Color color, SqlSchema info, SqlInstance inst) {
super(new GridLayout(1, 1));
this.info = info;
this.inst = inst;
this.color = color;
makeCards();
makeGraph();
makeUI();
if (inst == null) {
add(top);
} else {
JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
pane.setResizeWeight(.75);
pane.setDividerSize(2);
pane.add(top);
pane.add(bottom);
add(pane);
}
setBorder(BorderFactory.createEtchedBorder());
}
private JComponent onlyColors() {
JPanel p1 = new JPanel(new GridLayout(size() - 12, 1));
JPanel p2 = new JPanel(new GridLayout(size() - 12 , 1));
JSplitPane p = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
p.add(p1);
p.add(p2);
for (IdeOption o : IdeOption.values()) {
if (o.type == IdeOptionType.COLOR) {
p1.add(new JLabel(o.toString()));
p2.add(viewerFor(o));
}
}
// p.setPreferredSize(theD);
return p;
}
private JComponent outline() {
JPanel p1 = new JPanel(new GridLayout(7, 1));
JPanel p2 = new JPanel(new GridLayout(7, 1));
JSplitPane p = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// p.setPreferredSize(theD);
p.add(p1);
p.add(p2);
for (IdeOption o : IdeOption.values()) {
if (o.name().contains("OUTLINE")) {
p1.add(new JLabel(o.toString()));
p2.add(viewerFor(o));
}
}
return p;
}
private SqlMapper() {
super(new BorderLayout());
JButton transButton = new JButton("Guess Mapping");
transButton.addActionListener(x -> doRun());
JPanel tp = new JPanel(new GridLayout(1, 4));
tp.add(transButton);
tp.add(new JLabel());
tp.add(new JLabel());
tp.add(new JLabel());
JSplitPane jspX = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
jspX.setBorder(BorderFactory.createEmptyBorder());
jspX.setDividerSize(2);
jspX.setResizeWeight(0.5d);
jspX.add(input1);
jspX.add(input2);
JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
jsp.setBorder(BorderFactory.createEmptyBorder());
jsp.setDividerSize(4);
jsp.setResizeWeight(0.7d);
jsp.add(jspX);
jsp.add(output);
JPanel ret = new JPanel(new GridLayout(1, 1));
ret.add(jsp);
add(ret, BorderLayout.CENTER);
add(tp, BorderLayout.NORTH);
setBorder(BorderFactory.createEtchedBorder());
}
public static void showLoader() {
CodeTextPanel output = new CodeTextPanel(BorderFactory.createEtchedBorder(), "Response", "");
SqlLoader input = new SqlLoader(output, "");
JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
jsp.setBorder(BorderFactory.createEmptyBorder());
jsp.setDividerSize(4);
jsp.setResizeWeight(0.5d);
jsp.add(input);
jsp.add(output);
JPanel ret = new JPanel(new GridLayout(1, 1));
ret.add(jsp);
GuiUtil.show(ret, 700, 600, "SQL Loader");
}
private JSplitPane addSpectraMS2() {
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
SpectraVisualizerWindow spectraWindowMS2 = new SpectraVisualizerWindow(rawFiles[0]);
spectraWindowMS2.loadRawData(rawFiles[0].getScan(feature.getMostIntenseFragmentScanNumber()));
pane.add(spectraWindowMS2.getSpectrumPlot());
pane.add(spectraWindowMS2.getToolBar());
pane.setResizeWeight(1);
pane.setEnabled(false);
pane.setDividerSize(0);
return pane;
}
private void situateNotElongated() {
JPanel cp = new JPanel(new BorderLayout());
cp.add(sp);
cp.add(errorStrip, BorderLayout.LINE_END);
cp.setBorder(BorderFactory.createEtchedBorder());
JComponent newtop = cp;
if (enable_outline) {
JSplitPane xx2 = new Split(.8, JSplitPane.HORIZONTAL_SPLIT);
xx2.setDividerSize(6);
if (outline_on_left) {
xx2.setResizeWeight(.2);
xx2.add(p);
xx2.add(cp);
} else {
xx2.setResizeWeight(.8);
xx2.add(cp);
xx2.add(p);
}
xx2.setBorder(BorderFactory.createEmptyBorder());
newtop = xx2;
}
JSplitPane xx1 = new Split(.8, JSplitPane.VERTICAL_SPLIT);
xx1.setDividerSize(6);
xx1.setResizeWeight(.8);
xx1.add(newtop);
xx1.add(respAreaX);
xx1.setBorder(BorderFactory.createEmptyBorder());
respAreaX.setMinimumSize(new Dimension(0, 0));
this.removeAll();
add(xx1);
revalidate();
}
private void initLayout() {
JSplitPane splitPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPanel.setDividerLocation(230);
JScrollPane scrTextArea = new JScrollPane();
scrTextArea.setBorder(new TitledBorder(new LineBorder(Color.BLACK),
Bundle.HINT_ChartTopComponent_SCRPanelTitle(),
TitledBorder.CENTER,TitledBorder.TOP));
scrTextArea.setPreferredSize(new Dimension(220, 300));
scrTextArea.setViewportView(detailedLog);
JScrollPane scrTable = new JScrollPane();
scrTable.setBorder(new TitledBorder(new LineBorder(Color.BLACK),
Bundle.HINT_ChartTopComponent_SCRPanelTable(),
TitledBorder.CENTER,TitledBorder.TOP));
scrTable.setViewportView(cellChangesTable);
JScrollPane scrTC = new JScrollPane();
scrTC.setViewportView(panelChart);
splitPanel.add(scrTextArea);
splitPanel.add(scrTable);
JPanel tmp = new JPanel(new BorderLayout());
tmp.add(panelChart,BorderLayout.NORTH);
tmp.add(splitPanel,BorderLayout.CENTER);
JScrollPane tmpScr = new JScrollPane();
tmpScr.setViewportView(tmp);
add(tmpScr,BorderLayout.CENTER);
}
@Override
protected JComponent createComponent() {
Table<T> table = new Table<>(model);
table.getModel().addTableModelListener((event) -> {
if(event.getType() == TableModelEvent.INSERT) {
int viewRow = table.convertRowIndexToView(event.getLastRow());
table.scrollRectToVisible(table.getCellRect(viewRow, 0, true));
}
});
JTextPane message = new JTextPane();
message.setEditable(false);
message.setContentType("text/html");
JSplitPane contents = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
contents.add(new JScrollPane(table), JSplitPane.TOP);
contents.add(new JScrollPane(message), JSplitPane.BOTTOM);
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
// wait for it to finish
if(e.getValueIsAdjusting()) {
return;
}
int selectedRow = table.getSelectedRow();
T value = selectedRow > -1 && selectedRow < model.getRowCount() ? model.getValue(selectedRow) : null;
if(value != null) {
message.setText(getMessageValue(value));
message.setCaretPosition(0);
}
contents.revalidate();
}
});
return contents;
}
@Override
public void startup() {
setLayout(new BorderLayout());
final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setOneTouchExpandable(true);
splitPane.setResizeWeight(1.0);
add(splitPane);
modulesPanel.setPreferredSize(new Dimension(220, 200));
selectedPanel.setPreferredSize(new Dimension(350, 200));
JPanel top = new JPanel(new BorderLayout());
top.add(modulesPanel, BorderLayout.WEST);
top.add(selectedPanel, BorderLayout.CENTER);
JTabbedPane bottom = new JTabbedPane();
bottom.addTab("Tasks", Icons.getIcon(Icons.CONSOLE), tasksPanel);
bottom.setPreferredSize(new Dimension(300, 160));
top.setMinimumSize(new Dimension(300, 80));
splitPane.add(top, JSplitPane.TOP);
splitPane.add(bottom, JSplitPane.BOTTOM);
modulesPanel.startup();
selectedPanel.startup();
tasksPanel.startup();
setVisible(true);
}
private JSplitPane addSpectraMS1() {
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
SpectraVisualizerWindow spectraWindowMS1 = new SpectraVisualizerWindow(rawFiles[0]);
spectraWindowMS1.loadRawData(rawFiles[0].getScan(feature.getRepresentativeScanNumber()));
pane.add(spectraWindowMS1.getSpectrumPlot());
pane.add(spectraWindowMS1.getToolBar());
pane.setResizeWeight(1);
pane.setEnabled(false);
pane.setDividerSize(0);
return pane;
}
private JSplitPane addTicPlot(PeakListRow row) {
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// labels for TIC visualizer
Map<Feature, String> labelsMap = new HashMap<Feature, String>(0);
// scan selection
ScanSelection scanSelection = new ScanSelection(rawFiles[0].getDataRTRange(1), 1);
// mz range
Range<Double> mzRange = null;
mzRange = feature.getRawDataPointsMZRange();
// optimize output by extending the range
double upper = mzRange.upperEndpoint();
double lower = mzRange.lowerEndpoint();
double fiveppm = (upper * 5E-6);
mzRange = Range.closed(lower - fiveppm, upper + fiveppm);
// labels
labelsMap.put(feature, feature.toString());
TICVisualizerWindow window = new TICVisualizerWindow(rawFiles, // raw
TICPlotType.BASEPEAK, // plot type
scanSelection, // scan selection
mzRange, // mz range
row.getPeaks(), // selected features
labelsMap); // labels
pane.add(window.getTICPlot());
pane.add(window.getToolBar());
pane.setResizeWeight(1);
pane.setDividerSize(1);
pane.setBorder(BorderFactory.createLineBorder(Color.black));
return pane;
}
public SqlChecker() {
JButton transButton = new JButton("Check");
JComboBox<Example> box = new JComboBox<>(examples);
box.setSelectedIndex(-1);
box.addActionListener((ActionEvent e) -> input.setText(((Example) box.getSelectedItem()).getText()));
transButton.addActionListener(x -> check());
JPanel p = new JPanel(new BorderLayout());
JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
jsp.setBorder(BorderFactory.createEmptyBorder());
jsp.setDividerSize(2);
jsp.setResizeWeight(0.5d);
jsp.add(input);
jsp.add(output);
JPanel tp = new JPanel(new GridLayout(1, 4));
tp.add(transButton);
tp.add(haltOnErrors);
tp.add(new JLabel("Load Example", SwingConstants.RIGHT));
tp.add(box);
p.add(jsp, BorderLayout.CENTER);
p.add(tp, BorderLayout.NORTH);
JSplitPane jspX = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
jspX.setBorder(BorderFactory.createEmptyBorder());
JPanel panX = new JPanel(new GridLayout(1, 1));
jspX.setDividerSize(2);
jspX.setResizeWeight(0.4d);
panX.add(jspX);
jspX.add(loader);
jspX.add(p);
p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "SQL Checker"));
JFrame f = new JFrame("SQL Checker");
f.setContentPane(panX);
f.pack();
f.setSize(new Dimension(700, 600));
f.setLocationRelativeTo(null);
f.setVisible(true);
}
private void updateStyle(JSplitPane splitPane) {
SeaGlassContext context = getContext(splitPane, Region.SPLIT_PANE_DIVIDER, ENABLED);
SynthStyle oldDividerStyle = dividerStyle;
dividerStyle = SeaGlassLookAndFeel.updateStyle(context, this);
context.dispose();
context = getContext(splitPane, ENABLED);
SynthStyle oldStyle = style;
style = SeaGlassLookAndFeel.updateStyle(context, this);
if (style != oldStyle) {
Object value = style.get(context, "SplitPane.size");
if (value == null) {
value = new Integer(6);
}
LookAndFeel.installProperty(splitPane, "dividerSize", value);
value = style.get(context, "SplitPane.oneTouchExpandable");
if (value != null) {
LookAndFeel.installProperty(splitPane, "oneTouchExpandable", value);
}
if (divider != null) {
splitPane.remove(divider);
divider.setDividerSize(splitPane.getDividerSize());
}
if (oldStyle != null) {
uninstallKeyboardActions();
installKeyboardActions();
}
}
if (style != oldStyle || dividerStyle != oldDividerStyle) {
// Only way to force BasicSplitPaneDivider to reread the
// necessary properties.
if (divider != null) {
splitPane.remove(divider);
}
divider = createDefaultDivider();
divider.setBasicSplitPaneUI(this);
splitPane.add(divider, JSplitPane.DIVIDER);
}
context.dispose();
}
public JComponent createPanel() throws Exception {
JSplitPane vsplit_panel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
vsplit_panel.add(createSendPanel());
vsplit_panel.add(createRecvPanel());
return vsplit_panel;
}
private JPanel addSpectra(int scan) {
JPanel panel = new JPanel(new BorderLayout());
// Split pane for eic plot (top) and spectrum (bottom)
JSplitPane bottomPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
// Create EIC plot
// labels for TIC visualizer
Map<Feature, String> labelsMap = new HashMap<Feature, String>(0);
Feature peak = row.getPeak(activeRaw);
// scan selection
ScanSelection scanSelection = new ScanSelection(activeRaw.getDataRTRange(1), 1);
// mz range
Range<Double> mzRange = null;
mzRange = peak.getRawDataPointsMZRange();
// optimize output by extending the range
double upper = mzRange.upperEndpoint();
double lower = mzRange.lowerEndpoint();
double fiveppm = (upper * 5E-6);
mzRange = Range.closed(lower - fiveppm, upper + fiveppm);
// labels
labelsMap.put(peak, peak.toString());
// get EIC window
TICVisualizerWindow window = new TICVisualizerWindow(new RawDataFile[] {activeRaw}, // raw
TICPlotType.BASEPEAK, // plot type
scanSelection, // scan selection
mzRange, // mz range
null,
// new Feature[] {peak}, // selected features
labelsMap); // labels
// get EIC Plot
TICPlot ticPlot = window.getTICPlot();
// ticPlot.setPreferredSize(new Dimension(600, 200));
ticPlot.getChart().getLegend().setVisible(false);
// add a retention time Marker to the EIC
ValueMarker marker = new ValueMarker(activeRaw.getScan(scan).getRetentionTime());
marker.setPaint(Color.RED);
marker.setStroke(new BasicStroke(3.0f));
XYPlot plot = (XYPlot) ticPlot.getChart().getPlot();
plot.addDomainMarker(marker);
// bottomPane.add(ticPlot);
bottomPane.setResizeWeight(0.5);
bottomPane.setEnabled(true);
bottomPane.setDividerSize(5);
bottomPane.setDividerLocation(200);
JSplitPane spectrumPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// get MS/MS spectra window
SpectraVisualizerWindow spectraWindow = new SpectraVisualizerWindow(activeRaw);
spectraWindow.loadRawData(activeRaw.getScan(scan));
// get MS/MS spectra plot
SpectraPlot spectrumPlot = spectraWindow.getSpectrumPlot();
spectrumPlot.getChart().getLegend().setVisible(false);
// spectrumPlot.setPreferredSize(new Dimension(600, 400));
// spectrumPane.add(spectrumPlot);
// spectrumPane.add(spectraWindow.getToolBar());
spectrumPane.setResizeWeight(1);
spectrumPane.setEnabled(false);
spectrumPane.setDividerSize(0);
bottomPane.add(spectrumPane);
panel.add(bottomPane);
panel.setBorder(BorderFactory.createLineBorder(Color.black));
return panel;
}
public AssociationRuleTableViewer(AssociationRules rules) {
if (rules != null && rules.getNumberOfRules() > 0) {
this.model = new AssociationRuleTableModel(rules);
setLayout(new BorderLayout());
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setBorder(null);
// conclusion list
AssociationRuleFilter filter = new AssociationRuleFilter(rules);
filter.addAssociationRuleFilterListener(this);
filter.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 5));
splitPane.add(filter, 0);
// main panel
{
JPanel mainPanel = new JPanel();
mainPanel.setOpaque(true);
mainPanel.setBackground(Colors.WHITE);
GridBagLayout layout = new GridBagLayout();
mainPanel.setLayout(layout);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.insets = new Insets(15, 10, 10, 10);
table.setModel(model);
table.setRowHeight(PropertyPanel.VALUE_CELL_EDITOR_HEIGHT);
table.setRowHighlighting(true);
table.setAutoResizeMode(ExtendedJTable.AUTO_RESIZE_OFF);
JScrollPane tablePane = new ExtendedJScrollPane(table);
tablePane.setBorder(null);
tablePane.setBackground(Colors.WHITE);
tablePane.getViewport().setBackground(Colors.WHITE);
layout.setConstraints(tablePane, c);
mainPanel.add(tablePane);
setColumnSizes();
splitPane.add(mainPanel, 1);
table.getTableHeader().setBackground(Colors.WHITE);
table.getTableHeader().putClientProperty(RapidLookTools.PROPERTY_TABLE_HEADER_BACKGROUND, Colors.WHITE);
}
filter.triggerFilter();
add(splitPane, BorderLayout.CENTER);
} else {
add(ResultDisplayTools.createErrorComponent("No rules found"), BorderLayout.CENTER);
}
}
private JPanel addSpectra(int scan) {
JPanel panel = new JPanel(new BorderLayout());
// Split pane for eic plot (top) and spectrum (bottom)
JSplitPane bottomPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
// Create EIC plot
// labels for TIC visualizer
Map<Feature, String> labelsMap = new HashMap<Feature, String>(0);
Feature peak = row.getPeak(activeRaw);
// scan selection
ScanSelection scanSelection = new ScanSelection(activeRaw.getDataRTRange(1), 1);
// mz range
Range<Double> mzRange = null;
mzRange = peak.getRawDataPointsMZRange();
// optimize output by extending the range
double upper = mzRange.upperEndpoint();
double lower = mzRange.lowerEndpoint();
double fiveppm = (upper * 5E-6);
mzRange = Range.closed(lower - fiveppm, upper + fiveppm);
// labels
labelsMap.put(peak, peak.toString());
// get EIC window
TICVisualizerWindow window = new TICVisualizerWindow(new RawDataFile[] {activeRaw}, // raw
TICPlotType.BASEPEAK, // plot type
scanSelection, // scan selection
mzRange, // mz range
new Feature[] {peak}, // selected features
labelsMap); // labels
// get EIC Plot
TICPlot ticPlot = window.getTICPlot();
ticPlot.setPreferredSize(new Dimension(600, 200));
ticPlot.getChart().getLegend().setVisible(false);
// add a retention time Marker to the EIC
ValueMarker marker = new ValueMarker(activeRaw.getScan(scan).getRetentionTime());
marker.setPaint(Color.RED);
marker.setStroke(new BasicStroke(3.0f));
XYPlot plot = (XYPlot) ticPlot.getChart().getPlot();
plot.addDomainMarker(marker);
bottomPane.add(ticPlot);
bottomPane.setResizeWeight(0.5);
bottomPane.setEnabled(true);
bottomPane.setDividerSize(5);
bottomPane.setDividerLocation(200);
JSplitPane spectrumPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// get MS/MS spectra window
SpectraVisualizerWindow spectraWindow = new SpectraVisualizerWindow(activeRaw);
spectraWindow.loadRawData(activeRaw.getScan(scan));
// get MS/MS spectra plot
SpectraPlot spectrumPlot = spectraWindow.getSpectrumPlot();
spectrumPlot.getChart().getLegend().setVisible(false);
spectrumPlot.setPreferredSize(new Dimension(600, 400));
spectrumPane.add(spectrumPlot);
spectrumPane.add(spectraWindow.getToolBar());
spectrumPane.setResizeWeight(1);
spectrumPane.setEnabled(false);
spectrumPane.setDividerSize(0);
bottomPane.add(spectrumPane);
panel.add(bottomPane);
panel.setBorder(BorderFactory.createLineBorder(Color.black));
return panel;
}
/**
*/
public MainPanel() {
super(new BorderLayout());
// Initialize item selector
rawDataTree = new ProjectTree();
peakListTree = new ProjectTree();
JScrollPane rawDataTreeScroll = new JScrollPane(rawDataTree);
JScrollPane peakListTreeScroll = new JScrollPane(peakListTree);
JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
split.add(rawDataTreeScroll);
split.add(peakListTreeScroll);
split.setResizeWeight(0.5);
split.setMinimumSize(new Dimension(200, 200));
add(split, BorderLayout.CENTER);
taskTable = new TaskProgressTable();
add(taskTable, BorderLayout.SOUTH);
}
public FeatureOverviewWindow(PeakListRow row) {
this.feature = row.getBestPeak();
rawFiles = row.getRawDataFiles();
setBackground(Color.white);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
JSplitPane splitPaneCenter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
add(splitPaneCenter);
// split pane left for plots
JSplitPane splitPaneLeftPlot = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPaneCenter.add(splitPaneLeftPlot);
// add Tic plots
splitPaneLeftPlot.add(addTicPlot(row));
// add feature data summary
splitPaneLeftPlot.add(addFeatureDataSummary(row));
// split pane right
JSplitPane splitPaneRight = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPaneCenter.add(splitPaneRight);
// add spectra MS1
splitPaneRight.add(addSpectraMS1());
// add Spectra MS2
if (feature.getMostIntenseFragmentScanNumber() > 0) {
splitPaneRight.add(addSpectraMS2());
} else {
JPanel noMSMSPanel = new JPanel();
JLabel noMSMSScansFound = new JLabel("Sorry, no MS/MS scans found!");
noMSMSScansFound.setFont(new Font("Dialog", Font.BOLD, 16));
noMSMSScansFound.setForeground(Color.RED);
noMSMSPanel.add(noMSMSScansFound, SwingConstants.CENTER);
splitPaneRight.add(noMSMSPanel, SwingConstants.CENTER);
}
setVisible(true);
validate();
repaint();
pack();
}