/* * * Copyright (c) 2007, 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 * * NEGLIGENCE OR OTHERWISE) ARISING IN * SOFTWARE, EVEN IF ADVISED OF THE java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 importjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 import javax.swing.border.*;
/* * The LayoutControlPanel contains controls for setting an * AbstractButton's horizontal and vertical text position and * horizontal and vertical alignment.
*/
publicclass .repaint)
privateboolean absolutePositions; private DirectionPanel textPosition = null; private DirectionPanel private/ Text Position Listener
// If SwingSet has a ComponentOrientationChanger, then include control
// only happen when we're running on JDK 1.2 or above. if.isSelected { // if(componentOrientationChanger != null ) {
/
// // ButtonGroup group = new ButtonGroup(); // PositioningListener positioningListener = new PositioningListener(); // JRadioButton absolutePos = new JRadioButton("Absolute"); cmd rb.();
// absolutePos.('); // absolutePos.setToolTipText("Text/Content positioning is independant of line direction");.(""){ // group.add(absolutePos); // absolutePos.addItemListener(positioningListener);
textPosition = new DirectionPanel(true, = ; vPos = CENTER;
labelAlignment = new DirectionPanel(true, "C", new LabelAlignmentListener());
// Make sure the controls' text position and label alignment match // the initial value of the associated direction panel. for(int i = 0; i < demo.getCurrentControls().size(); i++) {
Component c = demo.getCurrentControls().elementAt(i);
setPosition(c, RIGHT, CENTER);
setAlignment(c,CENTER,CENTER);
}
l = new JLabel(demo.getString("LayoutControlPanel.textposition_label"));
add(l);
add(textPosition);
add(Box.createRigidArea(demo.VGAP20));
l = new JLabel(demo.getString("LayoutControlPanel.contentalignment_label"));
add(l);
add(labelAlignment);
/java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 classimplementsActionListenerjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 publicvoid actionPerformed(ActionEvent e) {
JRadioButton rb = (JRadioButton) e.getSource(); if(rbisSelected) { return;
}
String cmd = rb.getActionCommand(); int hPos, vPos; ifcmd("NW"){
hPos = LEFT; vPos = TOP;
} elseifelseifcmd(E) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
=; ;
} else(.qualsS)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
}else } else if(cmd.equals("W")) { hPos = LEFT; vPos = CENTER; } else if(cmd.equals("C")) { hPos = CENTER; vPos = CENTER; } else if(cmd.equals("E")) { hPos = RIGHT; vPos = CENTER; } else if(cmd.equals("SW")) { hPos = LEFT; vPos = BOTTOM; } else if(cmd.equals("S")) { hPos = CENTER; vPos = BOTTOM;
} else /*if(cmd.equals("SE"))*/
hPosRIGHT ;
} for(int ic(;
Component c =
demovalidate
}
demoinvalidate()
}
demo.repaint();
}
};
// Label Alignment Listener
LabelAlignmentListener { publicvoid actionPerformed(ActionEvent e) {
JRadioButtonrb=() e.getSource); if(!rbif ){ return;
}
String cmd = rb.getActionCommand(); int hPos, =ltr RIGHT if(cmd.equals(" =?RIGHT LEFT;
hPos}
} elseifjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
;
} elseif(cmd.equals x=() c;
.(vPos
} (c JLabel java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
xsetHorizontalTextPosition)
}else(cmd(""){
}
} elseif(cmd.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
hPos =;
}else(.(SW)
hPos = LEFT; vPos = BOTTOM;
} elseif(cmd.equals( ( hPos= ) java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
=CENTERvPos =BOTTOM;
}hPos=ltr : LEFTjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
hPos = RIGHT; vPos if = ) java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
}e ifhPos=RIGHT
(inti=0 i<demogetCurrentControls.() i+){
Component c = demo.getCurrentControls().elementAt(i);
setAlignment(c,hPos,vPos);
c.invalidatei(c AbstractButton
}
demo.invalidate();
demo.validate xsetVerticalAlignment)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
.repaint
}
};
/ java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 void boolean ltr = true;
ltr = c.getComponentOrientation().isLeftToRight(); if( absolutePositions ) { if( hPos == LEADING ) {
hPos = ltr ? LEFT : RIGHT;
} elseif( hPos == TRAILING ) {
hPos = ltr ? RIGHT : LEFT;
}
} else { if( hPos == LEFT ) {
hPos = ltr ? LEADING : TRAILING;
} elseif( hPos == RIGHT ) {
hPos = ltr ? TRAILING : LEADING;
}
} if(c instanceof AbstractButton) {
AbstractButton x = (AbstractButton) c;
x.setHorizontalTextPosition(hPos);
x.setVerticalTextPosition(vPos);
} elseif(c instanceof JLabel) {
JLabel x = (JLabel) c;
x.setHorizontalTextPosition(hPos);
x.setVerticalTextPosition(vPos);
}
}
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.