/* * * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Oracle nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** * main method allows us to run as a standalone demo.
*/ publicstaticvoid main(String[] args) {
SplitPaneDemo demo = new SplitPaneDemo(null);
demo.mainImpl();
}
/** * Creates controls to alter the JSplitPane.
*/ protected JPanel createSplitPaneControls() {
JPanel wrapper = new JPanel();
ButtonGroup group = new ButtonGroup();
JRadioButton button;
Box buttonWrapper = new Box(BoxLayout.X_AXIS);
wrapper.setLayout(new GridLayout(0, 1));
/* Create a radio button to vertically split the split pane. */
button = new JRadioButton(getString("SplitPaneDemo.vert_split"));
button.setMnemonic(getMnemonic("SplitPaneDemo.vert_split_mnemonic"));
button.addActionListener(new ActionListener() { publicvoid actionPerformed(ActionEvent e) {
splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
}
});
group.add(button);
buttonWrapper.add(button);
/* Create a radio button the horizontally split the split pane. */
button = new JRadioButton(getString("SplitPaneDemo.horz_split"));
button.setMnemonic(getMnemonic("SplitPaneDemo.horz_split_mnemonic"));
button.setSelected(true);
button.addActionListener(new ActionListener() { publicvoid actionPerformed(ActionEvent e) {
splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
}
});
group.add(button);
buttonWrapper.add(button);
/* Create a check box as to whether or not the split pane continually
lays out the component when dragging. */
JCheckBox checkBox = new JCheckBox(getString("SplitPaneDemo.cont_layout"));
checkBox.setMnemonic(getMnemonic("SplitPaneDemo.cont_layout_mnemonic"));
checkBox.setSelected(true);
/* Create a check box as to whether or not the split pane divider
contains the oneTouchExpandable buttons. */
checkBox = new JCheckBox(getString("SplitPaneDemo.one_touch_expandable"));
checkBox.setMnemonic(getMnemonic("SplitPaneDemo.one_touch_expandable_mnemonic"));
checkBox.setSelected(true);
/* Create a text field that will change the preferred/minimum size
of the earth component. */
earthSize = new JTextField(String.valueOf(earth.getMinimumSize().width));
earthSize.setColumns(5);
earthSize.getAccessibleContext().setAccessibleName(getString("SplitPaneDemo.first_component_min_size"));
earthSize.addActionListener(new ActionListener() { publicvoid actionPerformed(ActionEvent e) {
String value = ((JTextField)e.getSource()).getText(); int newSize;
/* Create a text field that will change the preferred/minimum size
of the moon component. */
moonSize = new JTextField(String.valueOf(moon.getMinimumSize().width));
moonSize.setColumns(5);
moonSize.getAccessibleContext().setAccessibleName(getString("SplitPaneDemo.second_component_min_size"));
moonSize.addActionListener(new ActionListener() { publicvoid actionPerformed(ActionEvent e) {
String value = ((JTextField)e.getSource()).getText(); int newSize;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.