下面列出了javax.swing.JSplitPane#setOneTouchExpandable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Creates the content of the tool window panel, with {@link SarosToolbar} and the {@link
* SessionAndContactsTreeView}.
*/
public SarosMainPanelView(@NotNull Project project) throws HeadlessException {
super(new BorderLayout());
SessionAndContactsTreeView sarosTree = new SessionAndContactsTreeView(project);
SarosToolbar sarosToolbar = new SarosToolbar(project);
JScrollPane treeScrollPane = new JBScrollPane(sarosTree);
treeScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
treeScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
// chartPane is empty at the moment
Container chartPane = new JPanel(new BorderLayout());
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScrollPane, chartPane);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(350);
// Provide minimum sizes for the two components in the split pane
Dimension minimumSize = new Dimension(300, 50);
treeScrollPane.setMinimumSize(minimumSize);
splitPane.setMinimumSize(minimumSize);
add(splitPane, BorderLayout.CENTER);
add(sarosToolbar, BorderLayout.NORTH);
}
@Override
protected JComponent getCenter()
{
// Build the settings panel
JPanel emptyPanel = new JPanel();
emptyPanel.setPreferredSize(new Dimension(780, 420));
settingsTree = new TreeView<>();
settingsTree.setRoot(new TreeItem<>(null));
// Build the split pane
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, GuiUtility.wrapParentAsJFXPanel(settingsTree),
emptyPanel
);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerSize(10);
return splitPane;
}
protected JComponent createDefaultDemoPane(final InternalDemoHandler demoHandler)
{
final JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
final URL url = demoHandler.getDemoDescriptionSource();
final JComponent scroll = createDescriptionTextPane(url);
final JButton previewButton = new JButton(getPreviewAction());
final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setTopComponent(scroll);
splitPane.setBottomComponent(demoHandler.getPresentationComponent());
splitPane.setDividerLocation(200);
splitPane.setOneTouchExpandable(true);
content.add(splitPane, BorderLayout.CENTER);
content.add(previewButton, BorderLayout.SOUTH);
return content;
}
/**
* Creates a new panel object.
*
* @param graph Graph that provides the data for the components in this panel.
* @param selectionHistory Shows the selection history of the given graph.
* @param searchField Search field that is used to search through the graph.
*/
public CStandardLeftPanel(final ZyGraph graph, final CSelectionHistory selectionHistory,
final CGraphSearchField searchField) {
super(new BorderLayout());
Preconditions.checkNotNull(searchField, "IE01810: Search field argument can not be null");
m_undoHistory = new CSelectionHistoryChooser(graph, selectionHistory);
final JSplitPane bottomSplitter = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true,
m_nodeChooser = new CNodeChooser(graph, searchField), m_undoHistory);
final JSplitPane topSplitter = new JSplitPane(
JSplitPane.VERTICAL_SPLIT, true, new CGraphOverview(graph), bottomSplitter);
topSplitter.setDividerLocation(200);
bottomSplitter.setDoubleBuffered(true);
bottomSplitter.setResizeWeight(0.75);
bottomSplitter.setOneTouchExpandable(true);
bottomSplitter.setMinimumSize(new Dimension(0, 0));
topSplitter.setDoubleBuffered(true);
topSplitter.setOneTouchExpandable(true);
topSplitter.setMinimumSize(new Dimension(0, 0));
topSplitter.setDividerLocation(200);
add(topSplitter);
}
private void initView() {
this.setLayout(new GridLayout(1, 1));
if (roomId == null) {
messagePanel.setVisible(false);
messageEditorPanel.setVisible(false);
DebugUtil.debug("roomId == null");
}
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
// splitPane.setBorder(new RCBorder(RCBorder.BOTTOM,
// Colors.LIGHT_GRAY));
splitPane.setBorder(null);
// splitPane.setUI(new BasicSplitPaneUI());
// BasicSplitPaneDivider divider = (BasicSplitPaneDivider)
// splitPane.getComponent(0);
// divider.setBackground(Colors.FONT_BLACK);
// divider.setBorder(null);
splitPane.setOneTouchExpandable(false);
splitPane.setDividerLocation(450);
// splitPane.setResizeWeight(0.1);
splitPane.setDividerSize(2);
splitPane.setTopComponent(messagePanel);
splitPane.setBottomComponent(messageEditorPanel);
splitPane.setPreferredSize(new Dimension(MainFrame.DEFAULT_WIDTH, MainFrame.DEFAULT_HEIGHT));
// add(splitPane, new GBC(0, 0).setFill(GBC.BOTH).setWeight(1, 4));
// add(splitPane, new GBC(0, 0).setFill(GBC.BOTH).setWeight(1, 10));
add(splitPane);
// add(messagePanel, new GBC(0, 0).setFill(GBC.BOTH).setWeight(1, 4));
// add(messageEditorPanel, new GBC(0, 1).setFill(GBC.BOTH).setWeight(1,
// 1));
}
private JSplitPane createSplitPane() {
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setOneTouchExpandable(true);
splitPane.setLeftComponent(new JScrollPane(imagePanel));
splitPane.setRightComponent(getAnnotationPanel());
splitPane.resetToPreferredSizes();
return splitPane;
}
protected void prepareControls() {
JFrame frame = new JFrame("SplitPane Mixing");
JPanel p = new JPanel(new GridLayout());
p.setPreferredSize(new Dimension(500, 500));
propagateAWTControls(p);
sp1 = new JScrollPane(p);
JButton button = new JButton("JButton");
button.setBackground(Color.RED);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
clicked = true;
}
});
sp2 = new JScrollPane(button);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp1, sp2);
splitPane.setOneTouchExpandable(false);
splitPane.setDividerLocation(150);
splitPane.setPreferredSize(new Dimension(400, 200));
frame.getContentPane().add(splitPane);
frame.pack();
frame.setVisible(true);
}
/**
* Initialize the GUI panel
* @return
*/
private JSplitPane buildSplitPane() {
final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setLeftComponent(getLeftPanel());
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(150);
return splitPane;
}
/**
* Creates the elements of this component.
*/
private void createGui() {
final JPanel topPanel = new JPanel(new BorderLayout());
final JPanel innerTopPanel = new JPanel(new BorderLayout());
innerTopPanel.add(m_stdEditPanel);
topPanel.add(innerTopPanel);
final JPanel debuggerChooserPanel = new JPanel(new BorderLayout());
debuggerChooserPanel.setBorder(new TitledBorder("Project Debuggers"));
m_checkedList = new JCheckedListbox<>(new Vector<DebuggerTemplate>(), false);
updateCheckedListPanel();
final JScrollPane debuggerScrollPane = new JScrollPane(m_checkedList);
m_checkedListPanel.add(debuggerScrollPane);
debuggerChooserPanel.add(m_checkedListPanel, BorderLayout.CENTER);
debuggerChooserPanel.setMinimumSize(new Dimension(0, 128));
debuggerChooserPanel.setPreferredSize(new Dimension(0, 128));
innerTopPanel.add(debuggerChooserPanel, BorderLayout.SOUTH);
final JPanel buttonPanel = new JPanel(new GridLayout(1, 2));
buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 2));
buttonPanel.add(new JPanel());
buttonPanel.add(m_saveButton);
topPanel.add(buttonPanel, BorderLayout.SOUTH);
final JPanel bottomPanel = new CAddressSpacesTablePanel(m_table);
final JScrollPane scrollPane = new JScrollPane(m_table);
bottomPanel.setBorder(m_titledBorder);
setBorder(new EmptyBorder(0, 0, 0, 1));
bottomPanel.add(scrollPane);
final JSplitPane splitPane =
new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, topPanel, bottomPanel);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(splitPane.getMinimumDividerLocation());
splitPane.setResizeWeight(0.5);
add(splitPane);
}
private void init() {
setLayout(new BorderLayout());
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setOneTouchExpandable(true);
splitPane.setBottomComponent(objectTable);
TreeSearch tSearch = TreeSearch.installForOR(objectTree.getTree());
splitPane.setTopComponent(tSearch);
splitPane.setResizeWeight(.5);
splitPane.setDividerLocation(.5);
add(splitPane);
}
JSplitPane summaryTab() {
mainFrame.setSummaryTopPanel(new JPanel());
mainFrame.getSummaryTopPanel().setLayout(new GridLayout(0, 1));
mainFrame.getSummaryTopPanel().setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));
// mainFrame.getSummaryTopPanel().setMinimumSize(new Dimension(fontSize * 50, fontSize * 5));
JPanel summaryTopOuter = new JPanel(new BorderLayout());
summaryTopOuter.add(mainFrame.getSummaryTopPanel(), BorderLayout.NORTH);
mainFrame.getSummaryHtmlArea().setContentType("text/html");
mainFrame.getSummaryHtmlArea().setEditable(false);
mainFrame.getSummaryHtmlArea().addHyperlinkListener(evt -> AboutDialog.editorPaneHyperlinkUpdate(evt));
setStyleSheets();
// JPanel temp = new JPanel(new BorderLayout());
// temp.add(summaryTopPanel, BorderLayout.CENTER);
JScrollPane summaryScrollPane = new JScrollPane(summaryTopOuter);
summaryScrollPane.getVerticalScrollBar().setUnitIncrement((int) Driver.getFontSize());
JSplitPane splitP = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, summaryScrollPane,
mainFrame.getSummaryHtmlScrollPane());
splitP.setContinuousLayout(true);
splitP.setDividerLocation(GUISaveState.getInstance().getSplitSummary());
splitP.setOneTouchExpandable(true);
splitP.setUI(new BasicSplitPaneUI() {
@Override
public BasicSplitPaneDivider createDefaultDivider() {
return new BasicSplitPaneDivider(this) {
@Override
public void setBorder(Border b) {
}
};
}
});
splitP.setBorder(null);
return splitP;
}
private void createResultsPanel() {
resultPanel = new JPanel();
resultPanel.setLayout(new BorderLayout());
resultPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),
_archiveName));
// 508 compliance
resultPanel.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Panel")); // NOI18N
resultPanel.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"This_is_a_panel")); // NOI18N
// set up result table
tableModel = new DefaultTableModel(columnNames, 0);
table = new JTable(tableModel) {
@Override
public Component prepareRenderer(TableCellRenderer renderer,
int rowIndex, int vColIndex) {
Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
if (c instanceof JComponent) {
JComponent jc = (JComponent)c;
jc.setToolTipText((String)getValueAt(rowIndex, vColIndex));
}
return c;
}
};
// 508 for JTable
table.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Table")); // NOI18N
table.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"This_is_a_table_of_items"));//NOI18N
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tableScrollPane = new JScrollPane(table);
Object [] row = {NbBundle.getMessage(VerifierSupport.class,"Wait"),NbBundle.getMessage(VerifierSupport.class,"Running_Verifier_Tool..."),NbBundle.getMessage(VerifierSupport.class,"Running...") }; // NOI18N
tableModel.addRow(row);
//table.sizeColumnsToFit(0);
// 508 for JScrollPane
tableScrollPane.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Scroll_Pane")); // NOI18N
tableScrollPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(VerifierSupport.class,"ScrollArea")); // NOI18N
sizeTableColumns();
// make the cells uneditable
JTextField field = new JTextField();
// 508 for JTextField
field.getAccessibleContext().setAccessibleName(
NbBundle.getMessage(VerifierSupport.class,"Text_Field")); // NOI18N
field.getAccessibleContext().setAccessibleDescription(
NbBundle.getMessage(VerifierSupport.class,"This_is_a_text_field")); // NOI18N
table.setDefaultEditor(Object.class, new DefaultCellEditor(field) {
@Override
public boolean isCellEditable(EventObject anEvent) {
return false;
}
});
// add action listener to table to show details
tableSelectionListener = new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e){
if (!e.getValueIsAdjusting()){
if(table.getSelectionModel().isSelectedIndex(e.getLastIndex())){
setDetailText( table.getModel().getValueAt(e.getLastIndex(),1)+
"\n"+table.getModel().getValueAt(e.getLastIndex(),2));//NOI18N
}else if(table.getSelectionModel().isSelectedIndex(e.getFirstIndex())){
setDetailText(table.getModel().getValueAt(e.getFirstIndex(),1)+
"\n"+table.getModel().getValueAt(e.getFirstIndex(),2));//NOI18N
}
}
}
};
table.getSelectionModel().addListSelectionListener(tableSelectionListener);
// create detail text area
detailText = new JTextArea(4,50);
// 508 for JTextArea
detailText.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Text_Area")); // NOI18N
detailText.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"This_is_a_text_area"));//NOI18N
detailText.setEditable(false);
textScrollPane = new JScrollPane(detailText);
// 508 for JScrollPane
textScrollPane.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Scroll_Pane")); // NOI18N
textScrollPane.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"ScrollListPane"));//NOI18N
textScrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), NbBundle.getMessage(VerifierSupport.class,"Detail:")));// NOI18N
//add the components to the panel
createControlPanel();
//Create a split pane with the two scroll panes in it.
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
tableScrollPane, textScrollPane);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(150);
//Provide minimum sizes for the two components in the split pane
Dimension minimumSize = new Dimension(100, 50);
tableScrollPane.setMinimumSize(minimumSize);
textScrollPane.setMinimumSize(minimumSize);
resultPanel.add("North", controlPanel); //NOI18N
resultPanel.add("Center", splitPane); // NOI18N
}
@Override
public Component getComponent(int width, int height) throws IOException {
final JPanel base = new JPanel();
base.setOpaque(false);
base.setPreferredSize(new Dimension(width, height));
base.setLayout(new BorderLayout());
final JPanel controls = new JPanel();
final JButton runBtn = new JButton("Run");
runBtn.setActionCommand("run");
runBtn.addActionListener(this);
controls.add(runBtn);
base.add(controls, BorderLayout.NORTH);
textArea = new RSyntaxTextArea(20, 60);
Font font = textArea.getFont();
font = font.deriveFont(font.getStyle(), 18);
textArea.setFont(font);
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_GROOVY);
textArea.setCodeFoldingEnabled(true);
textArea.setText(initialScript);
final RTextScrollPane inputScrollPane = new RTextScrollPane(textArea);
outputPane = new JTextPane();
outputPane.setEditable(false);
outputPane.setFont(new Font("Monospaced", Font.PLAIN, 18));
outputPane.setBorder(new EmptyBorder(4, 4, 4, 4));
final JScrollPane outputScrollPane = new JScrollPane(outputPane);
splitPane = new JSplitPane(orientation, inputScrollPane, outputScrollPane);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(width / 2);
final Dimension minimumSize = new Dimension(100, 50);
inputScrollPane.setMinimumSize(minimumSize);
outputScrollPane.setMinimumSize(minimumSize);
final JPanel body = new JPanel();
body.setBackground(Color.RED);
body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS));
body.add(splitPane);
base.add(body, BorderLayout.CENTER);
installInterceptors();
return base;
}
private void createResultsPanel() {
resultPanel = new JPanel();
resultPanel.setLayout(new BorderLayout());
resultPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),
_archiveName));
// 508 compliance
resultPanel.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Panel")); // NOI18N
resultPanel.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"This_is_a_panel")); // NOI18N
// set up result table
tableModel = new DefaultTableModel(columnNames, 0);
table = new JTable(tableModel) {
@Override
public Component prepareRenderer(TableCellRenderer renderer,
int rowIndex, int vColIndex) {
Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
if (c instanceof JComponent) {
JComponent jc = (JComponent)c;
jc.setToolTipText((String)getValueAt(rowIndex, vColIndex));
}
return c;
}
};
// 508 for JTable
table.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Table")); // NOI18N
table.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"This_is_a_table_of_items"));//NOI18N
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tableScrollPane = new JScrollPane(table);
Object [] row = {NbBundle.getMessage(VerifierSupport.class,"Wait"),NbBundle.getMessage(VerifierSupport.class,"Running_Verifier_Tool..."),NbBundle.getMessage(VerifierSupport.class,"Running...") }; // NOI18N
tableModel.addRow(row);
//table.sizeColumnsToFit(0);
// 508 for JScrollPane
tableScrollPane.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Scroll_Pane")); // NOI18N
tableScrollPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(VerifierSupport.class,"ScrollArea")); // NOI18N
sizeTableColumns();
// make the cells uneditable
JTextField field = new JTextField();
// 508 for JTextField
field.getAccessibleContext().setAccessibleName(
NbBundle.getMessage(VerifierSupport.class,"Text_Field")); // NOI18N
field.getAccessibleContext().setAccessibleDescription(
NbBundle.getMessage(VerifierSupport.class,"This_is_a_text_field")); // NOI18N
table.setDefaultEditor(Object.class, new DefaultCellEditor(field) {
@Override
public boolean isCellEditable(EventObject anEvent) {
return false;
}
});
// add action listener to table to show details
tableSelectionListener = new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e){
if (!e.getValueIsAdjusting()){
if(table.getSelectionModel().isSelectedIndex(e.getLastIndex())){
setDetailText( table.getModel().getValueAt(e.getLastIndex(),1)+
"\n"+table.getModel().getValueAt(e.getLastIndex(),2));//NOI18N
}else if(table.getSelectionModel().isSelectedIndex(e.getFirstIndex())){
setDetailText(table.getModel().getValueAt(e.getFirstIndex(),1)+
"\n"+table.getModel().getValueAt(e.getFirstIndex(),2));//NOI18N
}
}
}
};
table.getSelectionModel().addListSelectionListener(tableSelectionListener);
// create detail text area
detailText = new JTextArea(4,50);
// 508 for JTextArea
detailText.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Text_Area")); // NOI18N
detailText.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"This_is_a_text_area"));//NOI18N
detailText.setEditable(false);
textScrollPane = new JScrollPane(detailText);
// 508 for JScrollPane
textScrollPane.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Scroll_Pane")); // NOI18N
textScrollPane.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"ScrollListPane"));//NOI18N
textScrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), NbBundle.getMessage(VerifierSupport.class,"Detail:")));// NOI18N
//add the components to the panel
createControlPanel();
//Create a split pane with the two scroll panes in it.
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
tableScrollPane, textScrollPane);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(150);
//Provide minimum sizes for the two components in the split pane
Dimension minimumSize = new Dimension(100, 50);
tableScrollPane.setMinimumSize(minimumSize);
textScrollPane.setMinimumSize(minimumSize);
resultPanel.add("North", controlPanel); //NOI18N
resultPanel.add("Center", splitPane); // NOI18N
}
/**
* Constructs an OSPControl.
*
* @param _model
*/
public OSPControl(Object _model) {
super(ControlsRes.getString("OSPControl.Default_Title")); //$NON-NLS-1$
model = _model;
if(model!=null) {
// added by D Brown 2006-09-10
// modified by D Brown 2007-10-17
if(OSPRuntime.getTranslator()!=null) {
OSPRuntime.getTranslator().associate(this, model.getClass());
}
String name = model.getClass().getName();
setTitle(name.substring(1+name.lastIndexOf("."))+ControlsRes.getString("OSPControl.Controller")); //$NON-NLS-1$ //$NON-NLS-2$
}
Font labelFont = new Font("Dialog", Font.BOLD, 12); //$NON-NLS-1$
inputLabel = new JLabel(ControlsRes.getString("OSPControl.Input_Parameters"), SwingConstants.CENTER); //$NON-NLS-1$
inputLabel.setFont(labelFont);
messageTextArea = new JTextArea(5, 5) {
public void paintComponent(Graphics g) {
if(OSPRuntime.antiAliasText) {
Graphics2D g2 = (Graphics2D) g;
RenderingHints rh = g2.getRenderingHints();
rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
}
super.paintComponent(g);
}
};
JScrollPane messageScrollPane = new JScrollPane(messageTextArea);
// contains a view of the control
JPanel topPanel = new JPanel(new BorderLayout());
topPanel.add(inputLabel, BorderLayout.NORTH);
topPanel.add(controlScrollPane, BorderLayout.CENTER);
buttonPanel.setVisible(true);
topPanel.add(buttonPanel, BorderLayout.SOUTH); // buttons are added using addButton method.
// clear panel acts like a button to clear the message area
JPanel clearPanel = new JPanel(new BorderLayout());
clearPanel.addMouseListener(new ClearMouseAdapter());
clearLabel = new JLabel(ControlsRes.getString("OSPControl.Clear")); //$NON-NLS-1$
clearLabel.setFont(new Font(clearLabel.getFont().getFamily(), Font.PLAIN, 9));
clearLabel.setForeground(Color.black);
clearPanel.add(clearLabel, BorderLayout.WEST);
// contains the messages
JPanel bottomPanel = new JPanel(new BorderLayout());
messageLabel = new JLabel(ControlsRes.getString("OSPControl.Messages"), SwingConstants.CENTER); //$NON-NLS-1$
messageLabel.setFont(labelFont);
bottomPanel.add(messageLabel, BorderLayout.NORTH);
bottomPanel.add(messageScrollPane, BorderLayout.CENTER);
bottomPanel.add(clearPanel, BorderLayout.SOUTH);
Container cp = getContentPane();
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, bottomPanel);
splitPane.setOneTouchExpandable(true);
cp.add(splitPane, BorderLayout.CENTER);
messageTextArea.setEditable(false);
controlScrollPane.setPreferredSize(new Dimension(350, 200));
controlScrollPane.setMinimumSize(new Dimension(0, 50));
messageScrollPane.setPreferredSize(new Dimension(350, 75));
if((OSPRuntime.getTranslator()!=null)&&(model!=null)) {
OSPRuntime.getTranslator().associate(table, model.getClass());
}
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((d.width-getSize().width)/2, (d.height-getSize().height)/2); // center the frame
init();
ToolsRes.addPropertyChangeListener("locale", this); //$NON-NLS-1$
}
private void buildBottomPanel(JPanel parent, String layout, JPanel bottomPanel) {
//parent.add(bottomPanel, layout);
////bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
bottomPanel.setLayout(new BorderLayout(3, 3));
bottomPanel.setPreferredSize(new Dimension(800, 250));
/*
JPanel audioOpts = new JPanel();
bottomPanel.add(audioOpts, BorderLayout.NORTH);
rdbtnShowFFT = new JCheckBox("Show FFT");
rdbtnShowFFT.addItemListener(this);
rdbtnShowFFT.setSelected(true);
audioOpts.add(rdbtnShowFFT);
*/
audioGraph = new AudioGraphPanel();
audioGraph.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
bottomPanel.add(audioGraph, BorderLayout.CENTER);
audioGraph.setBackground(Color.LIGHT_GRAY);
//audioGraph.setPreferredSize(new Dimension(800, 250));
if (audioGraphThread != null) { audioGraph.stopProcessing(); }
audioGraphThread = new Thread(audioGraph);
audioGraphThread.setUncaughtExceptionHandler(Log.uncaughtExHandler);
audioGraphThread.start();
JPanel eyePhasorPanel = new JPanel();
eyePhasorPanel.setLayout(new BorderLayout());
eyePanel = new EyePanel();
eyePanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
bottomPanel.add(eyePhasorPanel, BorderLayout.EAST);
eyePhasorPanel.add(eyePanel, BorderLayout.WEST);
eyePanel.setBackground(Color.LIGHT_GRAY);
eyePanel.setPreferredSize(new Dimension(200, 100));
eyePanel.setMaximumSize(new Dimension(200, 100));
eyePanel.setVisible(true);
phasorPanel = new PhasorPanel();
phasorPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
eyePhasorPanel.add(phasorPanel, BorderLayout.EAST);
phasorPanel.setBackground(Color.LIGHT_GRAY);
phasorPanel.setPreferredSize(new Dimension(200, 100));
phasorPanel.setMaximumSize(new Dimension(200, 100));
phasorPanel.setVisible(false);
fftPanel = new FFTPanel();
fftPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
fftPanel.setBackground(Color.LIGHT_GRAY);
//bottomPanel.add(fftPanel, BorderLayout.SOUTH);
showFFT(false);
fftPanel.setPreferredSize(new Dimension(100, 150));
fftPanel.setMaximumSize(new Dimension(100, 150));
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
bottomPanel, fftPanel);
splitPane.setOneTouchExpandable(true);
splitPane.setContinuousLayout(true); // repaint as we resize, otherwise we can not see the moved line against the dark background
if (Config.splitPaneHeight != 0)
splitPane.setDividerLocation(Config.splitPaneHeight);
else
splitPane.setDividerLocation(200);
SplitPaneUI spui = splitPane.getUI();
if (spui instanceof BasicSplitPaneUI) {
// Setting a mouse listener directly on split pane does not work, because no events are being received.
((BasicSplitPaneUI) spui).getDivider().addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if (Config.iq == true) {
splitPaneHeight = splitPane.getDividerLocation();
//Log.println("SplitPane: " + splitPaneHeight);
Config.splitPaneHeight = splitPaneHeight;
}
}
});
}
;
parent.add(splitPane, layout);
}
@Override
protected JSplitPane createMainPanel() {
JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
mainPanel.setOneTouchExpandable(false);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
double widthRatio = 0.5;
formWidth = Math.max((int) (Math.min(screenSize.width, MAX_4K_WIDTH) * widthRatio), MIN_WIDTH);
double heightRatio = 0.6;
int formHeight = Math.max((int) (Math.min(screenSize.height, MAX_4K_HEIGHT) * heightRatio), MIN_HEIGHT);
getJDialog().setMinimumSize(new Dimension(formWidth + 16, formHeight + 72));
// top panel first
JSplitPane topPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
topPanel.setOneTouchExpandable(false);
JPanel descriptorPanel = createDescriptorAndVariablesAndPreprocessingPanel();
Dimension topPanelDimension = new Dimension((int)((formWidth - 3 * DEFAULT_PADDING) * 0.5), (int)((formHeight - 3 * DEFAULT_PADDING) * 0.75));
descriptorPanel.setMinimumSize(topPanelDimension);
descriptorPanel.setPreferredSize(topPanelDimension);
topPanel.setLeftComponent(descriptorPanel);
JPanel configurationPanel = createToolInfoPanel();
configurationPanel.setMinimumSize(topPanelDimension);
configurationPanel.setPreferredSize(topPanelDimension);
topPanel.setRightComponent(configurationPanel);
topPanel.setDividerLocation(0.5);
// bottom panel last
JPanel bottomPannel = createParametersPanel();
Dimension bottomPanelDimension = new Dimension(formWidth - 2 * DEFAULT_PADDING, (int)((formHeight - 3 * DEFAULT_PADDING) * 0.25));
bottomPannel.setMinimumSize(bottomPanelDimension);
bottomPannel.setPreferredSize(bottomPanelDimension);
mainPanel.setTopComponent(topPanel);
mainPanel.setBottomComponent(bottomPannel);
mainPanel.setDividerLocation(0.75);
mainPanel.setPreferredSize(new Dimension(formWidth, formHeight));
mainPanel.revalidate();
return mainPanel;
}
private void defineLayout ()
{
// +=============================================================+
// |toolKeyPanel . . . . . . . . . . . . . . . . . . . . . . . . |
// |+=================+=============================+===========+|
// || toolBar . . . . . . . . . .| progressBar . . .| Memory . .||
// |+=================+=============================+===========+|
// +=============================================================+
// | horiSplitPane . . . . . . . . . . . . . . . . . . . . . . . |
// |+=========================================+=================+|
// | . . . . . . . . . . . . . . . . . . . . .|boardsScrollPane ||
// | +========================================+ . . . . . . . . ||
// | | stubsController . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// |m| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// |a| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// |i| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// |n| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
// |P+=====================+==================+ . . . . . . . . ||
// |a| logPane . . . . . . | errors . . . . . | . . . . . . . . ||
// |n| . . . . . . . . . . |. . . . . . . . . | . . . . . . . . ||
// |e| . . . . . . . . . . |. . . . . . . . . | . . . . . . . . ||
// | +=====================+==================+=================+|
// +=============================================================+
//
// Individual panes
logPane = new LogPane();
boardsScrollPane = new BoardsScrollPane();
boardsScrollPane.setPreferredSize(new Dimension(350, 500));
// Bottom = Log & Errors
bottomPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
bottomPane.setBorder(null);
bottomPane.setDividerSize(1);
bottomPane.setResizeWeight(0.5d); // Cut in half initially
// mainPane = stubsController / bottomPane
mainPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, stubsController.getComponent(), null);
mainPane.setBorder(null);
mainPane.setOneTouchExpandable(true);
mainPane.setResizeWeight(0.9d); // Give bulk space to upper part
// horiSplitPane = mainPane | boards
appPane = new Panel();
appPane.setNoInsets();
appPane.setBorder(null);
appPane.setLayout(new BorderLayout());
appPane.add(mainPane, BorderLayout.CENTER); // + boardsScrollPane later
appPane.setName("appPane");
// Global layout: Use a toolbar on top and a double split pane below
///toolBar.add(toolKeyPanel);
Container content = frame.getContentPane();
content.setLayout(new BorderLayout());
content.add(ActionManager.getInstance().getToolBar(), BorderLayout.NORTH);
content.add(appPane, BorderLayout.CENTER);
// Display the boards pane?
if (GuiActions.getInstance().isBoardsWindowDisplayed()) {
appPane.add(boardsScrollPane, BorderLayout.EAST);
}
// Display the log pane?
if (GuiActions.getInstance().isLogWindowDisplayed()) {
bottomPane.setLeftComponent(logPane.getComponent());
}
// Display the errors pane?
if (GuiActions.getInstance().isErrorsWindowDisplayed()) {
bottomPane.setRightComponent(null);
}
// BottomPane = Log & Errors
if (needBottomPane()) {
mainPane.setBottomComponent(bottomPane);
}
}
@Override
public void initialize() {
Font buttonFont = viewSource.getFont();
viewSource.setFont(buttonFont.deriveFont(buttonFont.getSize() / 2));
viewSource.setPreferredSize(new Dimension(150, 15));
viewSource.setEnabled(false);
topLeftSPane = frame.mainFrameTree.bugListPanel();
JPanel sourceTitlePanel = new JPanel();
sourceTitlePanel.setLayout(new BorderLayout());
JPanel sourcePanel = new JPanel();
BorderLayout sourcePanelLayout = new BorderLayout();
sourcePanelLayout.setHgap(3);
sourcePanelLayout.setVgap(3);
sourcePanel.setLayout(sourcePanelLayout);
sourceTitle = new JLabel();
sourceTitle.setText(L10N.getLocalString("txt.source_listing", ""));
sourceTitlePanel.setBorder(new EmptyBorder(3, 3, 3, 3));
sourceTitlePanel.add(viewSource, BorderLayout.EAST);
sourceTitlePanel.add(sourceTitle, BorderLayout.CENTER);
sourcePanel.setBorder(new LineBorder(Color.GRAY));
sourcePanel.add(sourceTitlePanel, BorderLayout.NORTH);
sourcePanel.add(frame.createSourceCodePanel(), BorderLayout.CENTER);
sourcePanel.add(frame.createSourceSearchPanel(), BorderLayout.SOUTH);
topSPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, topLeftSPane, sourcePanel);
topSPane.setOneTouchExpandable(true);
topSPane.setContinuousLayout(true);
topSPane.setDividerLocation(GUISaveState.getInstance().getSplitTop());
removeSplitPaneBorders(topSPane);
summarySPane = frame.summaryTab();
mainSPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topSPane, summarySPane);
mainSPane.setOneTouchExpandable(true);
mainSPane.setContinuousLayout(true);
mainSPane.setDividerLocation(GUISaveState.getInstance().getSplitMain());
removeSplitPaneBorders(mainSPane);
frame.setLayout(new BorderLayout());
frame.add(mainSPane, BorderLayout.CENTER);
frame.add(frame.statusBar(), BorderLayout.SOUTH);
}
/**
* Creates the GUI elements of the component.
*/
private void createGui() {
final JPanel topPanel = new JPanel(new BorderLayout());
final JPanel innerTopPanel = new JPanel(new BorderLayout());
topPanel.add(innerTopPanel);
innerTopPanel.add(m_stdEditPanel);
innerTopPanel.add(m_debuggerPanel, BorderLayout.SOUTH);
final JPanel buttonPanel = new JPanel(new GridLayout(1, 2));
buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 2));
buttonPanel.add(new JPanel());
buttonPanel.add(m_saveButton);
topPanel.add(buttonPanel, BorderLayout.SOUTH);
final JPanel innerSp = new JPanel(new BorderLayout());
m_middlePanel.setPreferredSize(new Dimension(m_middlePanel.getPreferredSize().width, 75));
innerSp.add(m_middlePanel, BorderLayout.NORTH);
innerSp.add(m_bottomPanel, BorderLayout.CENTER);
final JSplitPane outerSp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, topPanel, innerSp);
outerSp.setOneTouchExpandable(true);
outerSp.setDividerLocation(outerSp.getMinimumDividerLocation());
outerSp.setResizeWeight(0.5);
final JPanel innerPanel = new JPanel(new BorderLayout());
innerPanel.add(outerSp);
add(innerPanel);
}