private void setScrollBarVisibility(final int visibility) {
final ScrollableJTextArea pane = getDelegate();
final JTextArea view = pane.getView();
view.setLineWrap(false);
switch (visibility) {
case TextArea.SCROLLBARS_NONE:
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
view.setLineWrap(true);
break;
case TextArea.SCROLLBARS_VERTICAL_ONLY:
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
view.setLineWrap(true);
break;
case TextArea.SCROLLBARS_HORIZONTAL_ONLY:
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
break;
default:
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
break;
}
}
java类java.awt.TextArea的实例源码
LWTextAreaPeer.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
ActionHistoryWindow.java 文件源码
项目:etomica
阅读 20
收藏 0
点赞 0
评论 0
public void actionPerformed() {
JFrame f = new JFrame();
TextArea textArea = new TextArea();
textArea.setEditable(false);
textArea.setBackground(Color.white);
textArea.setForeground(Color.black);
IData data = accumulatorHistory.getData();
IData xData = ((DataInfoFunction)accumulatorHistory.getDataInfo()).getXDataSource().getIndependentData(0);
for (int i=0; i<data.getLength(); i++) {
double x = xData.getValue(i);
double y = data.getValue(i);
if (Double.isNaN(x) || Double.isNaN(y)) continue;
textArea.append(x+"\t"+y+"\n");
}
f.add(textArea);
f.pack();
f.setSize(400,600);
f.setVisible(true);
}
ActionConfigWindow.java 文件源码
项目:etomica
阅读 22
收藏 0
点赞 0
评论 0
public void actionPerformed() {
JFrame f = new JFrame();
TextArea textArea = new TextArea();
textArea.setEditable(false);
textArea.setBackground(Color.white);
textArea.setForeground(Color.black);
int nLeaf = leafList.getAtomCount();
for (int iLeaf=0; iLeaf<nLeaf; iLeaf++) {
IAtom a = leafList.getAtom(iLeaf);
Vector pos = a.getPosition();
String str = Double.toString(pos.getX(0));
for (int i=1; i<pos.getD(); i++) {
str += " "+Double.toString(pos.getX(i));
}
textArea.append(str+"\n");
}
f.add(textArea);
f.pack();
f.setSize(400,600);
f.setVisible(true);
}
ActionVelocityWindow.java 文件源码
项目:etomica
阅读 24
收藏 0
点赞 0
评论 0
public void actionPerformed() {
JFrame f = new JFrame();
TextArea textArea = new TextArea();
textArea.setEditable(false);
textArea.setBackground(Color.white);
textArea.setForeground(Color.black);
int nLeaf = leafList.getAtomCount();
for (int iLeaf=0; iLeaf<nLeaf; iLeaf++) {
IAtomKinetic a = (IAtomKinetic)leafList.getAtom(iLeaf);
Vector vel = a.getVelocity();
String str = Double.toString(vel.getX(0));
for (int i=1; i<vel.getD(); i++) {
str += " "+Double.toString(vel.getX(i));
}
textArea.append(str+"\n");
}
f.add(textArea);
f.pack();
f.setSize(400,600);
f.setVisible(true);
}
LWTextAreaPeer.java 文件源码
项目:jdk8u-jdk
阅读 20
收藏 0
点赞 0
评论 0
private void setScrollBarVisibility(final int visibility) {
final ScrollableJTextArea pane = getDelegate();
final JTextArea view = pane.getView();
view.setLineWrap(false);
switch (visibility) {
case TextArea.SCROLLBARS_NONE:
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
view.setLineWrap(true);
break;
case TextArea.SCROLLBARS_VERTICAL_ONLY:
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
view.setLineWrap(true);
break;
case TextArea.SCROLLBARS_HORIZONTAL_ONLY:
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
break;
default:
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
break;
}
}
TextAreaTwicePack.java 文件源码
项目:jdk8u-jdk
阅读 26
收藏 0
点赞 0
评论 0
public static void main(final String[] args) {
final Frame frame = new Frame();
final TextArea ta = new TextArea();
frame.add(ta);
frame.pack();
frame.setVisible(true);
sleep();
final Dimension before = frame.getSize();
frame.pack();
final Dimension after = frame.getSize();
if (!after.equals(before)) {
throw new RuntimeException(
"Expected size: " + before + ", actual size: " + after);
}
frame.dispose();
}
SelectionAutoscrollTest.java 文件源码
项目:jdk8u-jdk
阅读 27
收藏 0
点赞 0
评论 0
void createObjects() {
textArea = new TextArea( bigString() );
robot = Util.createRobot();
Panel panel = new Panel();
panel.setLayout( new GridLayout(3,3) );
for( int y=0; y<3; ++y ) {
for( int x=0; x<3; ++x ) {
if( x==1 && y==1 ) {
panel.add( textArea );
} else {
panel.add( new Panel() );
}
}
}
Frame frame = new Frame( "TextArea cursor icon test" );
frame.setSize( 300, 300 );
frame.add( panel );
frame.setVisible( true );
}
SelectionVisible.java 文件源码
项目:jdk8u-jdk
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void init() {
tf = new TextField(20);
tf.setText("0123456789");
tf.select(0, 6);
final TextArea ta = new TextArea("INSTRUCTIONS:\n"
+ "The text 012345 should be selected in the TextField.\n"
+ "If this is what you observe, then the test passes.\n"
+ "Otherwise, the test fails.", 40, 5,
TextArea.SCROLLBARS_NONE);
ta.setEditable(false);
ta.setPreferredSize(new Dimension(300, 70));
final Panel panel = new Panel();
panel.setLayout(new FlowLayout());
panel.add(tf);
setLayout(new BorderLayout());
add(ta, BorderLayout.CENTER);
add(panel, BorderLayout.PAGE_END);
}
LWTextAreaPeer.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
private void setScrollBarVisibility(final int visibility) {
final ScrollableJTextArea pane = getDelegate();
final JTextArea view = pane.getView();
view.setLineWrap(false);
switch (visibility) {
case TextArea.SCROLLBARS_NONE:
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
view.setLineWrap(true);
break;
case TextArea.SCROLLBARS_VERTICAL_ONLY:
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
view.setLineWrap(true);
break;
case TextArea.SCROLLBARS_HORIZONTAL_ONLY:
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
break;
default:
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
break;
}
}
HighResTest.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
public TestDialog(Frame frame, String name) {
super(frame, name);
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
add("North", instructionsText);
messageText = new TextArea("", 5, maxStringLength, scrollBoth);
add("Center", messageText);
passB = new Button("pass");
passB.setActionCommand("pass");
passB.addActionListener(this);
buttonP.add("East", passB);
failB = new Button("fail");
failB.setActionCommand("fail");
failB.addActionListener(this);
buttonP.add("West", failB);
add("South", buttonP);
pack();
show();
}
DragEventSource.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
public TestDialog( Frame frame, String name )
{
super( frame, name );
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
add( "North", instructionsText );
messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
add("Center", messageText);
passB = new Button( "pass" );
passB.setActionCommand( "pass" );
passB.addActionListener( this );
buttonP.add( "East", passB );
failB = new Button( "fail" );
failB.setActionCommand( "fail" );
failB.addActionListener( this );
buttonP.add( "West", failB );
add( "South", buttonP );
pack();
setVisible(true);
}
TextAreaScrolling.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
TextAreaScrolling() {
try {
robot = new Robot();
} catch (Exception ex) {
throw new RuntimeException("Robot Creation Failed");
}
mainFrame = new Frame();
mainFrame.setSize(200, 200);
mainFrame.setLocation(200, 200);
textArea = new TextArea();
textArea.setText("1234 5678");
textArea.setSelectionStart(3);
textArea.setSelectionEnd(4);
mainFrame.add(textArea);
mainFrame.setVisible(true);
textArea.requestFocusInWindow();
}
TextAreaTwicePack.java 文件源码
项目:openjdk-jdk10
阅读 31
收藏 0
点赞 0
评论 0
public static void main(final String[] args) {
final Frame frame = new Frame();
final TextArea ta = new TextArea();
frame.add(ta);
frame.pack();
frame.setVisible(true);
sleep();
final Dimension before = frame.getSize();
frame.pack();
final Dimension after = frame.getSize();
if (!after.equals(before)) {
throw new RuntimeException(
"Expected size: " + before + ", actual size: " + after);
}
frame.dispose();
}
AutoScrollOnSelectAndAppend.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
public AutoScrollOnSelectAndAppend() {
try {
robot = new Robot();
} catch (Exception ex) {
throw new RuntimeException("Robot Creation Failed.");
}
frame = new Frame();
frame.setSize(200, 200);
frame.setLayout(new FlowLayout());
textArea = new TextArea(5, 20);
composeTextArea();
frame.add(textArea);
buttonHoldFocus = new Button("HoldFocus");
frame.add(buttonHoldFocus);
frame.setVisible(true);
robot.waitForIdle();
// Move mouse cursor on first row of text area.
Point loc = textArea.getLocationOnScreen();
robot.mouseMove(loc.x + 8, loc.y + 8);
robot.waitForIdle();
}
SelectionAutoscrollTest.java 文件源码
项目:openjdk-jdk10
阅读 22
收藏 0
点赞 0
评论 0
void createObjects() {
textArea = new TextArea( bigString() );
robot = Util.createRobot();
Panel panel = new Panel();
panel.setLayout( new GridLayout(3,3) );
for( int y=0; y<3; ++y ) {
for( int x=0; x<3; ++x ) {
if( x==1 && y==1 ) {
panel.add( textArea );
} else {
panel.add( new Panel() );
}
}
}
Frame frame = new Frame( "TextArea cursor icon test" );
frame.setSize( 300, 300 );
frame.add( panel );
frame.setVisible( true );
}
OverScrollTest.java 文件源码
项目:openjdk-jdk10
阅读 32
收藏 0
点赞 0
评论 0
OverScrollTest() {
try {
robot = new Robot();
} catch (Exception ex) {
throw new RuntimeException(ex.getMessage());
}
mainFrame = new Frame();
mainFrame.setSize(400, 200);
mainFrame.setLocation(200, 200);
mainFrame.setLayout(new FlowLayout());
textArea = new TextArea(2, 10);
textArea.setSize(300, 100);
textArea.setText("123456 789123");
mainFrame.add(textArea);
mainFrame.setVisible(true);
textArea.requestFocusInWindow();
}
SelectionVisible.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void init() {
ta = new TextArea(4, 20);
ta.setText("01234\n56789");
ta.select(3, 9);
final TextArea instruction = new TextArea("INSTRUCTIONS:\n"
+ "The text 34567 should be selected in the TextArea.\n"
+ "If this is what you observe, then the test passes.\n"
+ "Otherwise, the test fails.", 40, 5,
TextArea.SCROLLBARS_NONE);
instruction.setEditable(false);
instruction.setPreferredSize(new Dimension(300, 70));
final Panel panel = new Panel();
panel.setLayout(new FlowLayout());
panel.add(ta);
setLayout(new BorderLayout());
add(instruction, BorderLayout.CENTER);
add(panel, BorderLayout.PAGE_END);
}
ScrollSelectionTest.java 文件源码
项目:openjdk-jdk10
阅读 19
收藏 0
点赞 0
评论 0
public TestDialog(Frame frame, String name) {
super(frame, name);
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
add("North", instructionsText);
messageText = new TextArea("", 5, maxStringLength, scrollBoth);
add("Center", messageText);
buttonP = new Panel();
passB = new Button("pass");
passB.setActionCommand("pass");
passB.addActionListener(this);
buttonP.add("East", passB);
failB = new Button("Fail");
failB.setActionCommand("fail");
failB.addActionListener(this);
buttonP.add("West", failB);
add("South", buttonP);
pack();
setVisible(true);
}
SelectionVisible.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void init() {
tf = new TextField(20);
tf.setText("0123456789");
tf.select(0, 6);
final TextArea ta = new TextArea("INSTRUCTIONS:\n"
+ "The text 012345 should be selected in the TextField.\n"
+ "If this is what you observe, then the test passes.\n"
+ "Otherwise, the test fails.", 40, 5,
TextArea.SCROLLBARS_NONE);
ta.setEditable(false);
ta.setPreferredSize(new Dimension(300, 70));
final Panel panel = new Panel();
panel.setLayout(new FlowLayout());
panel.add(tf);
setLayout(new BorderLayout());
add(ta, BorderLayout.CENTER);
add(panel, BorderLayout.PAGE_END);
}
AltGraphModifierTest.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
public TestDialog(Frame frame, String name) {
super(frame, name);
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
add("North", instructionsText);
messageText = new TextArea("", 5, maxStringLength, scrollBoth);
add("Center", messageText);
buttonP = new Panel();
failB = new Button("Fail");
failB.setActionCommand("fail");
failB.addActionListener(this);
buttonP.add("Center", failB);
add("South", buttonP);
pack();
setVisible(true);
}
Test6991580.java 文件源码
项目:openjdk-jdk10
阅读 35
收藏 0
点赞 0
评论 0
public TestDialog( Frame frame, String name )
{
super( frame, name );
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
add( "North", instructionsText );
messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
add("Center", messageText);
passB = new Button( "pass" );
passB.setActionCommand( "pass" );
passB.addActionListener( this );
buttonP.add( "East", passB );
failB = new Button( "fail" );
failB.setActionCommand( "fail" );
failB.addActionListener( this );
buttonP.add( "West", failB );
add( "South", buttonP );
pack();
show();
}
Test6411624.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
public TestDialog( Frame frame, String name )
{
super( frame, name );
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
add( "North", instructionsText );
messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
add("Center", messageText);
passB = new Button( "pass" );
passB.setActionCommand( "pass" );
passB.addActionListener( this );
buttonP.add( "East", passB );
failB = new Button( "fail" );
failB.setActionCommand( "fail" );
failB.addActionListener( this );
buttonP.add( "West", failB );
add( "South", buttonP );
pack();
show();
}
Test4218609.java 文件源码
项目:openjdk-jdk10
阅读 19
收藏 0
点赞 0
评论 0
public TestDialog( Frame frame, String name )
{
super( frame, name );
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
add( "North", instructionsText );
messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
add("Center", messageText);
passB = new Button( "pass" );
passB.setActionCommand( "pass" );
passB.addActionListener( this );
buttonP.add( "East", passB );
failB = new Button( "fail" );
failB.setActionCommand( "fail" );
failB.addActionListener( this );
buttonP.add( "West", failB );
add( "South", buttonP );
pack();
show();
}
Test5032020.java 文件源码
项目:openjdk-jdk10
阅读 27
收藏 0
点赞 0
评论 0
public TestDialog( Frame frame, String name )
{
super( frame, name );
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
add( "North", instructionsText );
messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
add("Center", messageText);
passB = new Button( "pass" );
passB.setActionCommand( "pass" );
passB.addActionListener( this );
buttonP.add( "East", passB );
failB = new Button( "fail" );
failB.setActionCommand( "fail" );
failB.addActionListener( this );
buttonP.add( "West", failB );
add( "South", buttonP );
pack();
show();
}
Test4997635.java 文件源码
项目:openjdk-jdk10
阅读 22
收藏 0
点赞 0
评论 0
public TestDialog( Frame frame, String name )
{
super( frame, name );
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
add( "North", instructionsText );
messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
add("Center", messageText);
passB = new Button( "pass" );
passB.setActionCommand( "pass" );
passB.addActionListener( this );
buttonP.add( "East", passB );
failB = new Button( "fail" );
failB.setActionCommand( "fail" );
failB.addActionListener( this );
buttonP.add( "West", failB );
add( "South", buttonP );
pack();
show();
}
TextAreaBeanInfo.java 文件源码
项目:incubator-netbeans
阅读 18
收藏 0
点赞 0
评论 0
/** @return Propertydescriptors */
@Override
public PropertyDescriptor[] createPDs() throws IntrospectionException {
return new PropertyDescriptor[] {
new PropertyDescriptor("rows", TextArea.class), // NOI18N
new PropertyDescriptor("columns", TextArea.class), // NOI18N
};
}
PiAWT.java 文件源码
项目:apfloat
阅读 21
收藏 0
点赞 0
评论 0
public FlushStringWriter(TextArea dst)
{
this.dst = dst;
this.length = 0;
this.position = 0;
this.lastLinefeedPosition = 0;
}
TextAreaOperator.java 文件源码
项目:openjdk-jdk10
阅读 22
收藏 0
点赞 0
评论 0
/**
* Maps {@code TextArea.setColumns(int)} through queue
*/
public void setColumns(final int i) {
runMapping(new MapVoidAction("setColumns") {
@Override
public void map() {
((TextArea) getSource()).setColumns(i);
}
});
}
EmbeddedFrameTest1.java 文件源码
项目:jdk8u-jdk
阅读 23
收藏 0
点赞 0
评论 0
public TestDialog( Frame frame, String name )
{
super( frame, name );
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
add( "North", instructionsText );
messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
add("Center", messageText);
pack();
setVisible(true);
}
HoveringAndDraggingTest.java 文件源码
项目:jdk8u-jdk
阅读 28
收藏 0
点赞 0
评论 0
public void start() {
String[] instructions = new String[] {
"1. Notice components in test window: main-panel, box-for-text,"
+" 2 scroll-sliders, and 4 scroll-buttons.",
"2. Hover mouse over box-for-text."
+" Make sure, that mouse cursor is TextCursor (a.k.a. \"beam\").",
"3. Hover mouse over each of components (see item 1), except for box-for-text."
+" Make sure, that cursor is DefaultCursor (arrow).",
"4. Drag mouse (using any mouse button) from box-for-text to every"
+" component in item 1, and also outside application window."
+" Make sure, that cursor remains TextCursor while mouse button is pressed.",
"5. Repeat item 4 for each other component in item 1, except for box-for-text,"
+" _but_ now make sure that cursor is DefaultCursor.",
"6. If cursor behaves as described in items 2-3-4-5, then test passed; otherwise it failed."
};
Sysout.createDialogWithInstructions( instructions );
Panel panel = new Panel();
panel.setLayout( new GridLayout(3,3) );
for( int y=0; y<3; ++y ) {
for( int x=0; x<3; ++x ) {
if( x==1 && y==1 ) {
panel.add( new TextArea( bigString() ) );
} else {
panel.add( new Panel() );
}
}
}
Frame frame = new Frame( "TextArea cursor icon test" );
frame.setSize( 300, 300 );
frame.add( panel );
frame.setVisible( true );
}