package gui;
import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextField;
import listener.addHeaderListener;
import listener.removeHeaderListener;
public class headersGUI extends JDialog {
public JFrame GUI;
public JList headers;
public JTextField name;
public JTextField value;
public JButton addheader;
public JButton removeheader;
public headersGUI(JFrame initgui){
super(GUI, "Headers");
GUI=initgui;
setup();
layout();
this.pack();
this.setVisible(true);
}
public void setup(){
headers=new JList(GUI.headervalues);
headers.setLayoutOrientation(JList.VERTICAL);
name=new JTextField(10);
value=new JTextField(10);
addheader=new JButton("Add");
addheader.addActionListener(new addHeaderListener(this, GUI));
removeheader=new JButton("Remove");
removeheader.addActionListener(new removeHeaderListener(this, GUI));
}
public void layout(){
JPanel bottompanel=new JPanel();
this.getContentPane().add(headers, BorderLayout.CENTER);
bottompanel.add(new JLabel("Name: "));
bottompanel.add(name);
bottompanel.add(new JLabel("Value: "));
bottompanel.add(value);
bottompanel.add(addheader);
bottompanel.add(removeheader);
this.getContentPane().add(bottompanel, BorderLayout.SOUTH);
}
}
那就是JDialog
代碼呈現內容,它只是顯示一個空白JDialog
我使用JDK 1.5上MAC OSX 10.5.8的JDialog是不是沒有錯誤
如果您可以提供SSCCE(http://sscce.org/),我們應該能夠更輕鬆地提供幫助。 – Xorty
@xorty我沒有發表太多內容,也沒有看到對SSCCE的需求,因爲它是一個小的JDialog,它不包含太多的內容 – italiano40
@ italiano40:抱歉要苛刻,但是你上面的陳述是無知的廢話。如果你知道錯誤在哪裏,那麼你很可能已經解決了它。如果你發佈了足夠的代碼來解決它,我們會解決它。但是你不知道這一點,在這裏沒有人能夠根據所提供的信息很少解決這個問題。通過創建SSCCE的動議將幫助你分離問題,並可能讓你解決問題。 –