java顯示框
⑴ java中的輸入框為什麼要點一下才能顯示
組件的可見性設置。輸入框的可見性屬性被設置為不可見,在使用輸入框的代碼中,確保將其可見性設置為true,以便在創建後立即顯示。例如,使用setVisible(true)方法,因此java中的輸入框要點一下才能顯示。
⑵ JAVA編寫一個窗口(frame),要求窗口中有文本框,按鈕,標簽,單選框,復選框,
import javax.swing.*;
import java.awt.*;
public class test extends JFrame{
 public test(){
  JButton button; //按鈕
  JLabel label; //標簽
  JComboBox combobox;//下拉菜單
  JCheckBox checkbox;//復選框
  JRadioButton radiobutton;//單選框
  JTextField textfield;//文本框
  
  button = new JButton("按鈕");
  label = new JLabel("標簽:");
  checkbox = new JCheckBox("復選框一");
  radiobutton = new JRadioButton("單選框一");
  combobox = new JComboBox();
  textfield = new JTextField(100);
  
  Container  c = this.getContentPane();
  c.setLayout(new FlowLayout());
  c.add(button);
  c.add(label);
  c.add(checkbox);
  c.add(radiobutton);
  
  combobox.addItem("1");
  combobox.addItem("2");
  c.add(combobox);
  
  c.add(textfield);
  
  setSize(300, 200);
  setVisible(true);
 }
 public static void main(String[] args) {
  // TODO 自動生成方法存根
  test mytest = new test();
 }
}
⑶ java中的多行顯示文本框是哪個
重量級的是
java.util.Textarea
輕量級的是
javax.swing.JTextarea
⑷ 我想做一個JAVA的,當程序運行的時候彈出一個提示框,顯示運行的極度條。
做了一個多小時,終於編出來了,樓上寫的程序有很多問題而且不完整。樓主的要求沒寫明要操作資料庫,所以就初始用戶ID和密碼都設置成123。密碼正確後出現正在登陸的提示框,等登陸成功後,就關閉提示,退出程序。
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Test extends JFrame implements ActionListener,Runnable {
	
	JLabel jLabel1 = new JLabel();
	JLabel jLabel2 = new JLabel();
	JTextField jtUserID = new JTextField();
	JLabel jLabel3 = new JLabel();
	JPasswordField jpUsePwd = new JPasswordField();
	JButton jbEnter = new JButton();
	JButton jbExit = new JButton();
	
	//設置登陸的用戶名和密碼
	
	String userID="123";
	String userPwd="123";
	
	public Test() {
		super("用戶登陸界面");
		try {
			// 設置窗體的大小、位置、可見性
			jbInit();
			this.setVisible(true);
			this.setSize(410, 300);
			this.addWindowListener(new WindowAdapter() { // 清空內存
						public void windowClosing(WindowEvent e) {
							System.exit(0);
						}
					});
		} catch (Exception exception) {
			exception.printStackTrace();
		}
	}
	private void jbInit() throws Exception {
		// 初始化各控制項,設置控制項位置,將控制項添加到面板上
		getContentPane().setLayout(null);
		jtUserID.setText("");
		jtUserID.setBounds(new Rectangle(182, 50, 141, 22));
		jLabel2.setText("用戶名:");
		jLabel2.setBounds(new Rectangle(83, 50, 78, 24));
		jLabel3.setText("密    碼:");
		jLabel3.setBounds(new Rectangle(81, 91, 78, 24));
		jpUsePwd.setBounds(new Rectangle(182, 92, 140, 27));
		jbEnter.setBounds(new Rectangle(122, 197, 90, 25));
		jbEnter.setText("登陸");
		jbExit.setBounds(new Rectangle(217, 197, 90, 25));
		jbExit.setText("退出");
		this.getContentPane().add(jLabel2);
		this.getContentPane().add(jLabel3);
		this.getContentPane().add(jLabel1);
		this.getContentPane().add(jtUserID);
		this.getContentPane().add(jpUsePwd);
		this.getContentPane().add(jbEnter);
		this.getContentPane().add(jbExit);
		jbEnter.addActionListener(this);
		jbExit.addActionListener(this);
	}
//多線程式控制制登陸信息框
	public void run(){
		try{
		this.setVisible(false);
		JOptionPane.showMessageDialog(null, "正在登陸中....");
		Thread.sleep(3000);
		this.dispose();
		}catch(Exception e){
			System.out.println(e);
		}
		
	}
//當點擊按鈕的時候觸發下面的方法
	public void actionPerformed(ActionEvent e) {
		try{
		String command=e.getActionCommand();
		if (command.equals("退出")) {
			System.exit(0);
		} else {
			// 管理員登陸功能實現
			if (jtUserID.getText().equals("")
					|| new String(jpUsePwd.getPassword()).equals("")) {
				JOptionPane.showMessageDialog(null, "請輸入完整數據");
			} else {
						if (jtUserID.getText().equals(userID)
								&& new String(jpUsePwd.getPassword())
										.equals(userPwd)) {
							Thread t=new Thread(this);
							t.start();
}
					 else {
						JOptionPane.showMessageDialog(null, "帳號或者密碼錯誤");
						jtUserID.setText("");
						jpUsePwd.setText("");
						}
						}
			}
		}catch(Exception ex){
			System.out.println(ex);
		}
		}
	public static void main(String[] args) {
		 new Test();
	}
	}
⑸ eclipse java 底部的那個顯示運行結果的框被我一不小心關掉了,如何打開
那是eclipse種的Console控制台,重新顯示方式有以下幾種:
1、畝彎蔽方法一:
快捷鍵:ALT+SHIFT+Q
2、方法二:
點擊工具欄上的「window」輸入reset perspective
3、方法三:
①選擇上方工具欄「Window」功能欄目。

(5)java顯示框擴展閱讀
eclipse java常見問題解決方案
1、maven項目,啟動報錯ClassNotFoundException,原因是tomcat下WEB-INFclasses目錄中,java文件沒有編譯成class文件。
解決方式:在WEB-INFclasses目錄中,增加需要編譯的文件夾目錄。
2、eclipse一直報An internal error occurred ring: "Building workspace". GC overhead limit exceeded的錯鬧塵。
解決方式:更改Eclipse安裝文件夾下的eclipse.ini文件,加上-XX:MaxPermSize=1024m這個意思是在編譯文件時一直佔有最大內存,重啟Eclipse。
3、Eclipse 一直不停 building workspace。
解決方式:修改eclipse啟動文件 eclipse.ini 中添加啟動參數參數: -vmargs -Xmx512m
4、出現transport error 202: gethostbyname: unknown host錯誤
解決方式:系統下host文件中沒有將本機地址localhost映射到127.0.0.1導致,如果是win系統請查看系統盤下Windows目錄中System32driversetc下的host文件裡面是否有做相關映射如下(沒有則加上。如果之前有,但被注掉了,就釋放注釋)。
參迅州考資料:網路-Eclipse
⑹ java編程問題,顯示一個框體
效果圖
importjava.awt.*;
importjavax.swing.*;
{
	JPaneljp1,jp2,jp3;
	JLabeljlb1,jlb2;//是JLabel不是JLable
	JButtonjb1,jb2;
	JTextFieldjtf1;
	JPasswordFieldjpf1;
	publicstaticvoidmain(String[]args){//總是提示這里有問題
		demo8d6demo8d6=newdemo8d6();
	}
	publicdemo8d6()
	{
		jp1=newJPanel();
		jp2=newJPanel();
		jp3=newJPanel();
		
		jlb1=newJLabel("用戶名");//是JLabel不是JLable
		jlb2=newJLabel("密碼");//是JLabel不是JLable
		
		jb1=newJButton("登陸");//是JButton不是JButtom
		jb2=newJButton("取消");//是JButton不是JButtom
		
		jtf1=newJTextField(10);
		jpf1=newJPasswordField(10);
		
		this.setLayout(newGridLayout(3,1));
		
		jp1.add(jlb1);
		jp1.add(jtf1);
		
		jp2.add(jlb2);
		jp2.add(jpf1);
		
		jp3.add(jb1);
		jp3.add(jb2);
		
		//把各個JPanel加入JFrame
		this.add(jp1);
		this.add(jp2);
		this.add(jp3);
		
		this.setSize(300,150);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
		
	}
}
					
