Ich habe eine probleme und brauche eure hilfe.
ich moechte die addressPanel aus AddressUI.createUI() ins createUI in PartnerUI holen damit ich dort eine dialoge bauen kann. Wie schaffe ich
das?
Danke.
ich moechte die addressPanel aus AddressUI.createUI() ins createUI in PartnerUI holen damit ich dort eine dialoge bauen kann. Wie schaffe ich
das?
Danke.
Code:
package client.gui;
import java.awt.*;
import javax.swing.*;
import com.client.application.MainFrame;
import com.client.gui.base.BasicDialogUI;
import com.client.page.base.BasicDialogPage;
import com.client.table.model.AddressModel;
public class AddressUI extends BasicDialogUI{
/**
*
*/
private static final long serialVersionUID = -1214150134433745466L;
public AddressUI(MainFrame frame, BasicDialogPage page) {
super(frame, page);
}
@Override
public void createUI() {
AddressModel am = new AddressModel();
JTable table = new JTable(am);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setColumnSelectionAllowed(true);
JScrollPane scroller = new JScrollPane(table);
scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
JPanel addressPanel = new JPanel(new FlowLayout());
addressPanel.setBackground(Color.BLUE);
addressPanel.setForeground(Color.WHITE);
addressPanel.setOpaque(true);
JLabel addressHeader = new JLabel("Anschriften:");
JPanel addressHeaderPanel = new JPanel();
addressHeaderPanel.setBackground(Color.BLUE);
addressHeaderPanel.setForeground(Color.WHITE);
addressHeader.setOpaque(true);
addressHeaderPanel.add(addressHeader);
JButton buttonNew = new JButton("Neu");
JButton buttonChange = new JButton("Ändern");
JButton buttonDelete = new JButton ("Löschen");
JPanel buttonsPanel = new JPanel(new FlowLayout());
buttonsPanel.add(buttonNew);
buttonsPanel.add(buttonChange);
buttonsPanel.add(buttonDelete);
addressPanel.add(buttonsPanel, FlowLayout.RIGHT);
addressPanel.add(scroller, FlowLayout.CENTER);
addressPanel.add(addressHeaderPanel, FlowLayout.LEFT);
}
public final void showUI() {
createUI();
getMainFrame().setDialogPanel(this);
getMainFrame().pack();
this.setVisible(true);
}
@Override
public void formToModel() {
}
@Override
public void modelToForm() {
}
@Override
public boolean validateUI() {
return true;
}
}
Code:
package com.client.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JPanel;
import javax.swing.JTable;
import com.client.application.MainFrame;
import com.client.gui.base.BasicDialogUI;
import com.client.page.base.BasicDialogPage;
import com.client.table.model.PartnerModel;
public class PartnerUI extends BasicDialogUI{
private static final long serialVersionUID =1024614598666310834L;
public PartnerUI(MainFrame frame, BasicDialogPage page) {
super(frame, page);
}
@Override
public void createUI() {
JPanel partnerPanel = new JPanel();
partnerPanel.setBackground(Color.BLUE);
partnerPanel.setForeground(Color.WHITE);
partnerPanel.setOpaque(true);
PartnerModel pm = new PartnerModel();
JTable partnerTable = new JTable(pm);
partnerTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
partnerTable.setColumnSelectionAllowed(true);
partnerPanel.add(partnerTable, BorderLayout.CENTER);
}
@Override
public final void showUI() {
createUI();
getMainFrame().setDialogPanel(this);
getMainFrame().pack();
this.setVisible(true);
}
@Override
public void formToModel() {
}
@Override
public void modelToForm() {
}
@Override
public boolean validateUI() {
return true;
}
}