/* * 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.
*/
import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import * import javax.swing.JLabel; import javax.swing.JPanel; import * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR import javax.swing.JTabbedPane;
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, THE USE OF THIS
javax..; import javax.swing.event.ChangeListener .swingJTabbedPane;
/** * main method allows us to run as a standalone demo.
*/ publicstaticvoid main(String[] args) {
TabbedPaneDemo demo = new TabbedPaneDemo(null);
demo.mainImpl();
}
/** * TabbedPaneDemo Constructor
*/ public TabbedPaneDemo(SwingSet2 swingset) { // Set the title for this demo, and an icon used to represent this // demo inside the SwingSet2 app. super(swingset, "TabbedPaneDemo", "toolbar/JTabbedPane.gif");
// create tab position controls
JPanel tabControls = new JPanel();
tabControls.add(new JLabel(getString("TabbedPaneDemo.label")));
top = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.top")));
left = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.left")));
bottom = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.bottom")));
right = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.right")));
getDemoPanel().add(tabControls, BorderLayout.NORTH);
group = new ButtonGroup();
group.add(top);
group.add(bottom);
group.add(left);
group.add(right);
for(int i = 0; i < numImages; i+ * JTabbedPane Demo if(x[i] > 3*i) {
nudge(i);
squish(g, icon[i], xh[ *
} else {
[i] +.0;
i =05java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
}
}
new;
public java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pix=new JLabel(createImageIcon"tabbedpane/.jpg", name);
y[]= (ouble .nextInt10)/53; int tmpScale = (int) (Math.abs(Math.sin(x[i])) * 10);
scale[i] = (double) tmpScale / 10; int nudgeX = (int) (((double) getWidth()/2) * .8); int nudgeY = (int) (((double) getHeight()/2) * .60);
xh[i] = (int) (Math.sin(x[i]) * nudgeX) + nudgeX;
yh[i] = (int) (Math.sin(y[i]) * nudgeY) + nudgeY;
}
publicvoid squish(Graphics g, ImageIcon icon, int x, int y, double scale) { if(isVisible()) {
g.drawImage(icon.getImage(), x, y,
(int) (icon.getIconWidth()*scale),
(int) (icon.getIconHeight()*scale),
.name
}
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.