mockup of server's pda
This commit is contained in:
parent
8f6223db2d
commit
4f15524138
1
.idea/.gitignore
vendored
1
.idea/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
/out/
|
||||
|
@ -2,14 +2,11 @@
|
||||
public class MainRSP
|
||||
{
|
||||
|
||||
public static void main()
|
||||
public static void main( String[] args )
|
||||
{
|
||||
|
||||
// initialize the system
|
||||
|
||||
// working loop
|
||||
|
||||
// shut down the system?
|
||||
ServersAssistantMockupFrame samFrame = new ServersAssistantMockupFrame();
|
||||
samFrame.setVisible( true );
|
||||
|
||||
}
|
||||
|
||||
|
17
src/Order.java
Normal file
17
src/Order.java
Normal file
@ -0,0 +1,17 @@
|
||||
public class Order
|
||||
{
|
||||
int tableNo;
|
||||
String status;
|
||||
|
||||
public Order( int tableNo, String status )
|
||||
{
|
||||
this.tableNo = tableNo;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "table " + tableNo + ": " + status;
|
||||
}
|
||||
}
|
87
src/ServersAssistantMockupFrame.java
Normal file
87
src/ServersAssistantMockupFrame.java
Normal file
@ -0,0 +1,87 @@
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
|
||||
public class ServersAssistantMockupFrame extends JFrame
|
||||
{
|
||||
private final Order[] sample_data = // TODO : remove
|
||||
{
|
||||
new Order( 12, "in kitchen" ),
|
||||
new Order( 4, "ready" )
|
||||
};
|
||||
private final JList<Order> listOrders = new JList<Order>( sample_data );
|
||||
private final JButton btnNewOrder = new JButton( "NEW ORDER" );
|
||||
private final JButton btnServe = new JButton( "SERVE" );
|
||||
private final JButton btnCheck = new JButton( "CHECK" );
|
||||
|
||||
private final int MAIN_LAYOUT_GAP = 10;
|
||||
private final EmptyBorder emptyBorder = new EmptyBorder( 10, 10, 10, 10 ); // TODO : remove
|
||||
|
||||
public ServersAssistantMockupFrame()
|
||||
{
|
||||
setUpFrame();
|
||||
}
|
||||
|
||||
// region FRAME SET UP
|
||||
|
||||
private void setUpFrame()
|
||||
{
|
||||
// basics
|
||||
this.setSize( new Dimension( 360, 540 ) );
|
||||
this.setResizable( false );
|
||||
this.setTitle( "Servers Assistant Mockup" );
|
||||
this.setLocationRelativeTo( null );
|
||||
this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
|
||||
|
||||
// layout, gaps & borders
|
||||
this.setLayout( new BorderLayout( MAIN_LAYOUT_GAP, MAIN_LAYOUT_GAP ) );
|
||||
this.rootPane.setBorder( new EmptyBorder( MAIN_LAYOUT_GAP, MAIN_LAYOUT_GAP, MAIN_LAYOUT_GAP, MAIN_LAYOUT_GAP ) );
|
||||
|
||||
// subcomponent calls
|
||||
this.add( setUpPanelInfo(), BorderLayout.CENTER );
|
||||
this.add( setUpPanelButtons(), BorderLayout.NORTH );
|
||||
}
|
||||
|
||||
private JPanel setUpPanelInfo()
|
||||
{
|
||||
Font fontTable = new Font(
|
||||
new JLabel().getFont().getFontName(),
|
||||
Font.PLAIN,
|
||||
14
|
||||
);
|
||||
listOrders.setFont( fontTable );
|
||||
|
||||
JScrollPane scrollOrderList = new JScrollPane( listOrders );
|
||||
|
||||
JPanel panelInfo = new JPanel();
|
||||
panelInfo.setLayout( new BorderLayout() );
|
||||
panelInfo.add( scrollOrderList, BorderLayout.CENTER );
|
||||
return panelInfo;
|
||||
}
|
||||
|
||||
private JPanel setUpPanelButtons()
|
||||
{
|
||||
// removing the after-click-blue-border
|
||||
btnNewOrder.setFocusPainted( false );
|
||||
btnServe.setFocusPainted( false );
|
||||
btnCheck.setFocusPainted( false );
|
||||
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.setHgap( MAIN_LAYOUT_GAP /2 );
|
||||
|
||||
JPanel panelSmallButtons = new JPanel();
|
||||
panelSmallButtons.setLayout( layout );
|
||||
panelSmallButtons.add( btnServe );
|
||||
panelSmallButtons.add( btnCheck );
|
||||
|
||||
JPanel panelButtons = new JPanel();
|
||||
panelButtons.setLayout( layout );
|
||||
panelButtons.setPreferredSize( new Dimension( 0, 50 ) );
|
||||
panelButtons.add( btnNewOrder );
|
||||
panelButtons.add( panelSmallButtons );
|
||||
return panelButtons;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user