Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java GUI 设计 » SWT  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 如何让MENUBAR显示在TESTAREA上面
weiis





发贴: 2
积分: 0
于 2007-12-01 19:00 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
代码 如下,为什么我点击file 但是 会被TestArea1给遮住了?怎样让它显示在最上面??

package test;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

public class Test extends JFrame {
private JMenuBar menuBar = new JMenuBar();
private JMenu menuFile = new JMenu();
private JMenuItem menuFileExit = new JMenuItem();
private JMenu menuHelp = new JMenu();
private JMenuItem menuHelpAbout = new JMenuItem();
private TextArea textArea1 = new TextArea();
private Button button1 = new Button();
private Button button2 = new Button();
private TextArea textArea2 = new TextArea();

public Test() {
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
}

private void jbInit() throws Exception {
this.setJMenuBar( menuBar );
this.getContentPane().setLayout( null );
this.setSize(new Dimension(390, 532));
this.setTitle( "Test" );
menuFile.setText( "File" );
menuFileExit.setText( "Exit" );
menuFileExit.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent ae ) { fileExit_ActionPerformed( ae ); } } );
menuHelp.setText( "Help" );
menuHelpAbout.setText( "About" );
menuHelpAbout.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent ae ) { helpAbout_ActionPerformed( ae ); } } );
textArea1.setBounds(new Rectangle(0, 0, 385, 390));
button1.setLabel("button1");
button1.setBounds(new Rectangle(15, 400, 80, 30));
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
button1_actionPerformedEnvelope;
}
});
button2.setLabel("button2");
button2.setBounds(new Rectangle(15, 440, 80, 30));
button2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
button2_actionPerformedEnvelope;
}
});
textArea2.setBounds(new Rectangle(110, 400, 265, 70));
menuFile.add( menuFileExit );
menuBar.add( menuFile );
menuHelp.add( menuHelpAbout );
menuBar.add( menuHelp );
this.getContentPane().add(textArea2, null);
this.getContentPane().add(button2, null);
this.getContentPane().add(button1, null);
this.getContentPane().add(textArea1, null);
}

void fileExit_ActionPerformed(ActionEvent e) {
System.exit(0);
}

void helpAbout_ActionPerformed(ActionEvent e) {
//JOptionPane.showMessageDialog(this, new Frame2_AboutBoxPanel1(), "About", JOptionPane.PLAIN_MESSAGE);
}

private void button1_actionPerformed(ActionEvent e) {
}

private void button2_actionPerformed(ActionEvent e) {
}
public static void main(String []args){
  Test t=new Test();
  t.setVisible(true);
}
}



作者 Re:如何让MENUBAR显示在TESTAREA上面 [Re:weiis]
weiis





发贴: 2
积分: 0
于 2007-12-01 19:04 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list



作者 Re:如何让MENUBAR显示在TESTAREA上面 [Re:weiis]
ding1108





发贴: 2
积分: 0
于 2008-01-28 13:28 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
因为你用了TextArea,而不是用JTextArea



flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923