Hi,
kann mir einer vielleicht sagen warum meine Scrollpane nicht vom Look'n'Feel erfasst wird?
Danke,
Gruß Robin
kann mir einer vielleicht sagen warum meine Scrollpane nicht vom Look'n'Feel erfasst wird?
Code:
JLabel lab1 = new JLabel("Output:");
JTextArea outputarea = new JTextArea(5,30);
JScrollPane output_ta = new JScrollPane(outputarea,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
JMenuItem file_entry1,option_entry1,option_entry2,option_entry3,option_entry4,option_entry5,help_entry1;
//Border op = BorderFactory.createTitledBorder("Output"); // Rand mit Titel
//-----------
public GUI(){
// Fenstertitel
super("RTT RealtimeServer");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Fenstericon
setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage("rtt_rs.gif"));
// Look & Feel
String motif = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
String windows = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
String metal = "javax.swing.plaf.metal.MetalLookAndFeel";
try {
UIManager.setLookAndFeel(windows);
SwingUtilities.updateComponentTreeUI(this);}
catch (Exception e) {}
// GridBagLayout erzeugen
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints constr = new GridBagConstraints();
// Zuweisung des GridBagLayoutes zur ContentPane
//JPanel panel = new JPanel();
Container contentpane = getContentPane();
contentpane.setLayout(gridbag);
// Menubar
JMenuBar menubar = new JMenuBar();
JMenu file = new JMenu("File");
JMenu option = new JMenu("Option");
JMenu help = new JMenu("?");
// Menubar content
file_entry1 = new JMenuItem("Exit");
//option_entry1 = new JMenuItem("Restart Server");
option_entry2 = new JMenuItem("Close Server");
option_entry3 = new JMenuItem("DataBase - lose entry");
option_entry3.setEnabled(true);
option_entry4 = new JMenuItem("DataBase - keep entry");
option_entry4.setEnabled(false);
option_entry5 = new JMenuItem("Clear DataBase");
help_entry1 = new JMenuItem("About");
menubar.add(file);
menubar.add(option);
menubar.add(help);
file.add(file_entry1);
//edit.add(option_entry1);
option.add(option_entry2);
option.addSeparator();
option.add(option_entry3);
option.add(option_entry4);
option.addSeparator();
option.add(option_entry5);
help.add(help_entry1);
setJMenuBar(menubar);
file_entry1.addActionListener(this);
option_entry2.addActionListener(this);
option_entry3.addActionListener(this);
option_entry4.addActionListener(this);
option_entry5.addActionListener(this);
help_entry1.addActionListener(this);
// Label Output
lab1.setFont(new Font("Verdana", Font.PLAIN, 12));
constr.gridx = 0;
constr.gridy = 0;
contentpane.add(lab1, constr);
// Textarea - Output
constr.gridx = 0; // Position spalte
constr.gridy = 1; // Position zeile
constr.weightx = 100;
constr.weighty = 100;
constr.gridheight = 1; // Anzahl der Kästchen in einer zeile
constr.gridwidth = 1; // Anzahl der Kästchen in einer spalte
constr.fill = GridBagConstraints.BOTH;
constr.insets = new Insets(5, 5, 5, 5); // Platz zwischen den Komponenten
constr.anchor = GridBagConstraints.CENTER; // Ausrichtung links
contentpane.setLayout(gridbag);
contentpane.add(output_ta, constr);
Danke,
Gruß Robin