package de.unirostock.Singleton.example.gui; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import de.unirostock.Singleton.example.Shipowner; public class MainPanel extends javax.swing.JPanel { private Shipowner itsLeftOwner; private Shipowner itsRightOwner; public MainPanel() { super(); initShipOwners(); initGUI(); } /* * initializes nessesary attributes. */ private void initShipOwners(){ itsLeftOwner = new Shipowner( 10 ); itsRightOwner = new Shipowner( 5 ); } /* * creates the gui. */ private void initGUI() { try { GridBagLayout thisLayout = new GridBagLayout(); this.setLayout(thisLayout); this.setBackground(new java.awt.Color(255,255,255)); { ShipOwnerPanelLeft leftPanel = new ShipOwnerPanelLeft( itsLeftOwner ); this.add(leftPanel, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0)); } { ShipMarketPanel midPanel = new ShipMarketPanel(); this.add(midPanel, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); } { ShipOwnerPanelRight rightPanel = new ShipOwnerPanelRight( itsRightOwner ); this.add(rightPanel, new GridBagConstraints( 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 0, 2, 2), 0, 0)); } setSize(709, 170); } catch (Exception e) { e.printStackTrace(); } } }