下面列出了javax.swing.JPanel#setAutoscrolls ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public MultiSpectraVisualizerWindow(PeakListRow row, RawDataFile raw) {
setBackground(Color.WHITE);
setExtendedState(JFrame.MAXIMIZED_BOTH);
setMinimumSize(new Dimension(800, 600));
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
pnGrid = new JPanel();
// any number of rows
pnGrid.setLayout(new GridLayout(0, 1, 0, 25));
pnGrid.setAutoscrolls(true);
JScrollPane scrollPane = new JScrollPane(pnGrid);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
getContentPane().add(scrollPane, BorderLayout.CENTER);
JPanel pnMenu = new JPanel();
FlowLayout fl_pnMenu = (FlowLayout) pnMenu.getLayout();
fl_pnMenu.setVgap(0);
fl_pnMenu.setAlignment(FlowLayout.LEFT);
getContentPane().add(pnMenu, BorderLayout.NORTH);
JButton nextRaw = new JButton("next");
nextRaw.addActionListener(e -> nextRaw());
JButton prevRaw = new JButton("prev");
prevRaw.addActionListener(e -> prevRaw());
pnMenu.add(prevRaw);
pnMenu.add(nextRaw);
lbRaw = new JLabel();
pnMenu.add(lbRaw);
JLabel lbRawTotalWithFragmentation = new JLabel();
pnMenu.add(lbRaw);
int n = 0;
for (Feature f : row.getPeaks()) {
if (f.getMostIntenseFragmentScanNumber() > 0)
n++;
}
lbRawTotalWithFragmentation.setText("(total raw:" + n + ")");
// add charts
setData(row, raw);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
validate();
repaint();
pack();
}
public DialogFrame() {
setType(Type.POPUP);
setResizable(false);
setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
this.setTitle("Approving question");
this.setPreferredSize(new Dimension(400, 190));
this.setAlwaysOnTop(isAlwaysOnTopSupported());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75);
this.setIconImage(Toolkit.getDefaultToolkit().
getImage(getClass().getResource(LOGOPATH)));
final JPanel panel = new JPanel();
panel.setAutoscrolls(true);
getContentPane().add(panel, BorderLayout.CENTER);
panel.setLayout(null);
btnYes = new JButton("YES");
btnYes.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
btnYes.setBounds(291, 129, 91, 29);
panel.add(btnYes);
btnNo = new JButton("NO");
btnNo.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
btnNo.setBounds(199, 129, 91, 29);
panel.add(btnNo);
lblIcon = new JLabel("");
lblIcon.setIcon(new ImageIcon(DialogFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png")));
lblIcon.setBounds(14, 40, 69, 70);
panel.add(lblIcon);
textArea = new JTextArea();
textArea.setDisabledTextColor(new Color(153, 204, 255));
textArea.setBounds(95, 32, 287, 85);
textArea.setBackground(UIManager.getColor("ComboBox.background"));
textArea.setBorder(null);
textArea.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
textArea.setEditable(false);
textArea.setFont(new Font("Monospaced", Font.PLAIN, 14));
textArea.setLineWrap(true);
panel.add(textArea);
this.pack();
}
/**
* Create the frame.
*/
public ReadLogsWindow() {
setTitle("Coder HPMSA - [Read Logs]");
setBounds(100, 100, 660, 550);
setBackground(Color.decode("#066d95"));
setLocationRelativeTo(null);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.setIconImage(Toolkit.getDefaultToolkit().
getImage(getClass().getResource(LOGOPATH)));
final JScrollPane scrollPane = new JScrollPane();
scrollPane.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
getContentPane().add(scrollPane, BorderLayout.CENTER);
editorPane = new JTextPane();
editorPane.setBackground(new Color(255, 255, 240));
editorPane.setFont(new Font("Verdana", Font.PLAIN, 13));
editorPane.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
editorPane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
editorPane.setEditable(false);
scrollPane.setViewportView(editorPane);
final JPanel filesPanel = new JPanel();
filesPanel.setPreferredSize(new Dimension(200, 10));
getContentPane().add(filesPanel, BorderLayout.EAST);
filesPanel.setLayout(new BorderLayout(0, 0));
final JScrollPane listScrollPane = new JScrollPane();
listScrollPane.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
listScrollPane.setViewportView(logFilesList());
filesPanel.add(listScrollPane, BorderLayout.CENTER);
final JPanel titlePanel = new JPanel();
titlePanel.setPreferredSize(new Dimension(10, 40));
titlePanel.setBackground(Color.decode("#066d95"));
titlePanel.setAutoscrolls(true);
getContentPane().add(titlePanel, BorderLayout.NORTH);
titlePanel.setLayout(new BorderLayout(0, 0));
final JLabel lblTitle = new JLabel("SYSTEM LOG RECORDS");
lblTitle.setHorizontalTextPosition(SwingConstants.CENTER);
lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
lblTitle.setAutoscrolls(true);
lblTitle.setFont(new Font("Verdana", Font.BOLD, 25));
lblTitle.setForeground(UIManager.getColor("Button.highlight"));
titlePanel.add(lblTitle, BorderLayout.CENTER);
final StyledDocument doc = editorPane.getStyledDocument();
final SimpleAttributeSet center = new SimpleAttributeSet();
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
doc.setParagraphAttributes(0, doc.getLength(), center, false);
setVisible(true);
}
public SpectraIdentificationResultsWindow() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setSize(new Dimension(1400, 900));
getContentPane().setLayout(new BorderLayout());
setTitle("Processing...");
pnGrid = new JPanel();
// any number of rows
pnGrid.setLayout(new GridLayout(0, 1, 0, 0));
pnGrid.setBackground(Color.WHITE);
pnGrid.setAutoscrolls(false);
noMatchesFound = new JLabel("I'm working on it", SwingConstants.CENTER);
noMatchesFound.setFont(headerFont);
// yellow
noMatchesFound.setForeground(new Color(0xFFCC00));
pnGrid.add(noMatchesFound, BorderLayout.CENTER);
// Add the Windows menu
JMenuBar menuBar = new JMenuBar();
menuBar.add(new WindowsMenu());
// set font size of chart
JMenuItem btnSetup = new JMenuItem("Setup dialog");
btnSetup.addActionListener(e -> {
if (MZmineCore.getConfiguration()
.getModuleParameters(SpectraIdentificationResultsModule.class)
.showSetupDialog(this, true) == ExitCode.OK) {
showExportButtonsChanged();
}
});
menuBar.add(btnSetup);
JCheckBoxMenuItem cbCoupleZoomY = new JCheckBoxMenuItem("Couple y-zoom");
cbCoupleZoomY.setSelected(true);
cbCoupleZoomY.addItemListener(e -> setCoupleZoomY(cbCoupleZoomY.isSelected()));
menuBar.add(cbCoupleZoomY);
JMenuItem btnSetFont = new JMenuItem("Set chart font");
btnSetFont.addActionListener(e -> setChartFont());
menuBar.add(btnSetFont);
setJMenuBar(menuBar);
scrollPane = new JScrollPane(pnGrid);
getContentPane().add(scrollPane, BorderLayout.CENTER);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setViewportView(pnGrid);
totalMatches = new ArrayList<>();
matchPanels = new HashMap<>();
setCoupleZoomY(true);
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
validate();
repaint();
}
public MultiSpectraVisualizerWindow(PeakListRow row, RawDataFile raw) {
setBackground(Color.WHITE);
setExtendedState(JFrame.MAXIMIZED_BOTH);
setMinimumSize(new Dimension(800, 600));
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
pnGrid = new JPanel();
// any number of rows
pnGrid.setLayout(new GridLayout(0, 1, 0, 25));
pnGrid.setAutoscrolls(true);
JScrollPane scrollPane = new JScrollPane(pnGrid);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
getContentPane().add(scrollPane, BorderLayout.CENTER);
JPanel pnMenu = new JPanel();
FlowLayout fl_pnMenu = (FlowLayout) pnMenu.getLayout();
fl_pnMenu.setVgap(0);
fl_pnMenu.setAlignment(FlowLayout.LEFT);
getContentPane().add(pnMenu, BorderLayout.NORTH);
JButton nextRaw = new JButton("next");
nextRaw.addActionListener(e -> nextRaw());
JButton prevRaw = new JButton("prev");
prevRaw.addActionListener(e -> prevRaw());
pnMenu.add(prevRaw);
pnMenu.add(nextRaw);
lbRaw = new JLabel();
pnMenu.add(lbRaw);
JLabel lbRawTotalWithFragmentation = new JLabel();
pnMenu.add(lbRaw);
int n = 0;
for (Feature f : row.getPeaks()) {
if (f.getMostIntenseFragmentScanNumber() > 0)
n++;
}
lbRawTotalWithFragmentation.setText("(total raw:" + n + ")");
// add charts
setData(row, raw);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
validate();
repaint();
pack();
}