pete: Table

Beitrag lesen

Hi,
Danke
habs nun mal ein ein scrollpane gepackt, nun klappts :)

nun habe ich aber folgendes problem:
obwohl ich bei der Grösse 2x -1 angegeben habe, ist die Tabelle (oder scrollpane) nun Grössenmässig festgelegt....
woran liegt das?

hier der Code:

package pendenz;

import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;

public class dlgSuchergebnisse
    extends JDialog {

DB DB = new DB();
  JPanel panel1 = new JPanel();
  XYLayout xYLayout1 = new XYLayout();
  ScrollPane scrollPane1 = new ScrollPane();

public dlgSuchergebnisse(Frame frame, String title, boolean modal) {
    super(frame, title, modal);
    try {
      jbInit();
      pack();
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }
  }

public dlgSuchergebnisse() {
    this(null, "", false);
   try
   {
  String rowData[][] = {
      { "Japan", "245", "", "", "", "", "" }, { "USA", "240", "", "", "", "", "" }, { "Italien", "220", "", "", "", "", "" },
      {  "Spanien", "217", "", "", "", "", "" }, {"Türkei", "215", "", "", "", "", ""} ,{"England", "214", "", "", "", "", ""},
      {  "Frankreich", "190", "", "", "", "", "" }, {"Griechenland", "185", "", "", "", "", "" },
      { "Deutschland", "180", "", "", "", "", "" }, {"Portugal", "170", "", "", "", "", "" }
  };

String columnNames[] = {
      "Pendenz-ID", "Typ", "Bezeichnung", "Priorität", "Status", "Kunde", "verbleibende Tage"
  };

JTable table = new JTable(rowData, columnNames);
  panel1.add(table, new XYConstraints(20, 20, -1, -1));
  JScrollPane scrollPane = new JScrollPane( table );
    panel1.add(scrollPane, new XYConstraints(20, 20, -1, -1));
  }     catch(Exception ex) {
      ex.printStackTrace();
  }
}

private void jbInit() throws Exception {
    panel1.setLayout(xYLayout1);
    panel1.setMinimumSize(new Dimension(900, 500));
    panel1.setPreferredSize(new Dimension(900, 500));
    this.setResizable(false);
    this.setTitle("Pendenz-Verwaltung | Suchergebnisse");
    getContentPane().add(panel1);
  }

public void Settable(){
    try{

}     catch (Exception ex) {ex.printStackTrace();}
  }

}