public void setUpGUI(Container container) throws Exception { // <Begin_setUpGUI_Container> container.add(Top, BorderLayout.CENTER); Top.setLayout(null); JPanel1.setBounds(0, 0, 225, 415); Top.add(JPanel1); JPanel1.setLayout(null); RouterBtn.setBounds(60, 95, 110, 165); JPanel1.add(RouterBtn); eight.setBounds(170, 155, 45, 45); JPanel1.add(eight); one.setBounds(170, 105, 45, 45); JPanel1.add(one); six.setBounds(65, 40, 45, 55); JPanel1.add(six); three.setBounds(15, 105, 45, 45); JPanel1.add(three); four.setBounds(15, 205, 45, 45); JPanel1.add(four); seven.setBounds(15, 155, 45, 45); JPanel1.add(seven); two.setBounds(170, 205, 45, 45); JPanel1.add(two); ten.setBounds(120, 260, 45, 55); JPanel1.add(ten); five.setBounds(65, 260, 45, 55); JPanel1.add(five); nine.setBounds(120, 40, 45, 55); JPanel1.add(nine); JPanel2.setBounds(220, 0, 455, 415); Top.add(JPanel2); JPanel2.setLayout(new BorderLayout(5, 5)); JPanel2.add(JPanel3, BorderLayout.NORTH); JPanel3.setLayout(new FlowLayout(1, 5, 5)); JPanel3.add(JLabel1); JPanel2.add(JPanel4, BorderLayout.CENTER); JPanel4.setLayout(new CardLayout(5, 5)); JPanel2.add(JPanel5, BorderLayout.SOUTH); JPanel5.setLayout(new FlowLayout(2, 5, 5)); JPanel5.add(RefreshBtn); JPanel5.add(CloseBtn); // <End_setUpGUI_Container> }
/** * This method initializes jContentPane * * @return javax.swing.JPanel */ javax.swing.JPanel getJContentPane() { if (jContentPane == null) { jContentPane = new javax.swing.JPanel(); jContentPane.setLayout(new BorderLayout()); jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER); jContentPane.add(getJToolBar(), java.awt.BorderLayout.NORTH); jContentPane.add(getStatusPane(), java.awt.BorderLayout.SOUTH); } return jContentPane; }
public void setUpGUI(Container container) { // <Begin_setUpGUI_Container> container.add(Top, BorderLayout.CENTER); Top.setLayout(new BorderLayout(5, 5)); Top.add(JPanel1, BorderLayout.CENTER); JPanel1.setLayout(new BorderLayout(5, 5)); JPanel1.add(JScrollPane1, BorderLayout.CENTER); JScrollPane1.getViewport().add(JTable1); JPanel1.add(JPanel6, BorderLayout.WEST); JPanel6.setLayout(new BorderLayout(5, 5)); JPanel6.add(JLabel2, BorderLayout.CENTER); Top.add(JPanel2, BorderLayout.SOUTH); JPanel2.setLayout(new GridLayout(1, 1, 5, 5)); JPanel2.add(JPanel3); JPanel3.setLayout(new FlowLayout(2, 5, 5)); JPanel3.add(JButton1); JPanel3.add(JButton2); JPanel3.add(JButton3); JPanel3.add(closeButton); Top.add(JPanel5, BorderLayout.NORTH); JPanel5.setLayout(new GridLayout(2, 1, 5, 5)); JPanel5.add(JLabel1); // <End_setUpGUI_Container> }
// Initialize Board public void init() { // Create cells and handlers cells = new JTextField[gameBoard.boardSize * gameBoard.boardSize + 1]; // Redraw Panel boardPanel.removeAll(); boardPanel.setLayout(new GridLayout(gameBoard.boardSize, gameBoard.boardSize)); // Set layout JTextFilter TextFilter = new JTextFilter(3); JTextDocumentListener JTextDocFilter = new JTextDocumentListener(); for (int i = 1; i <= gameBoard.boardSize * gameBoard.boardSize; i++) { cells[i] = new JTextField(); ((AbstractDocument) cells[i].getDocument()).setDocumentFilter(TextFilter); ((AbstractDocument) cells[i].getDocument()).addDocumentListener(JTextDocFilter); ((AbstractDocument) cells[i].getDocument()).putProperty("index", i); cells[i].setHorizontalAlignment(JTextField.CENTER); cells[i].setFont(new Font("Agency FB", Font.BOLD, 24)); // Add elements to the grid content pane boardPanel.add(cells[i]); } // Initialize booleans gameOver = false; // Clear Board for (int i = 1; i <= (gameBoard.boardSize * gameBoard.boardSize); i++) { String ch = Integer.toString(this.gameBoard.cells[i]); char chr = '-'; if (ch.compareTo("0") == 0 || ch == Character.toString(chr)) { cells[i].setText(""); } else { cells[i].setText(ch); cells[i].setBackground(Color.lightGray); } } // gameBoard.out(); setVisible(true); this.boardPanel.repaint(); this.gameTimer.reset(); jButtonSOLVE.setEnabled(true); }
private JPanel getContentPanel() { JPanel contentPanel1 = new JPanel(); summaryPanel = new JPanel(); resultPanel = new JPanel(); jPanel1 = new javax.swing.JPanel(); createFilesButton = new JButton(); showFilesButton = new JButton(); contentPanel1.setLayout(new java.awt.BorderLayout()); jPanel1.setLayout(new MigLayout("wrap 1")); /* Summary */ summaryPanel.setLayout(new MigLayout("wrap 1,w 400")); summaryPanel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Summary", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Courier", Font.BOLD, 14))); summaryField = new JTextArea("", 10, 30); summaryField.setLineWrap(true); summaryField.setWrapStyleWord(true); summaryField.setEditable(false); JScrollPane summaryScrollPane = new JScrollPane(summaryField); summaryScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS & JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); summaryPanel.add(summaryScrollPane); createFilesButton.setText("Create Data Loader CLI Files"); createFilesButton.setActionCommand(CREATE_FILES_ACTION_COMMAND); summaryPanel.add(createFilesButton, ""); jPanel1.add(summaryPanel); /* Results */ resultPanel.setLayout(new MigLayout("wrap 1,w 400")); resultPanel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Results", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Courier", Font.BOLD, 14))); statusField = new JTextArea("", 6, 30); statusField.setLineWrap(true); statusField.setWrapStyleWord(true); statusField.setEditable(false); JScrollPane messageScrollPane = new JScrollPane(statusField); messageScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS & JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); resultPanel.add(messageScrollPane); /* Not supported by Java 1.5 showFilesButton.setText("Show Files"); showFilesButton.setActionCommand(SHOW_FILES_ACTION_COMMAND); showFilesButton.setEnabled(false); resultPanel.add(showFilesButton,""); */ jPanel1.add(resultPanel); /* End */ contentPanel1.add(jPanel1, java.awt.BorderLayout.CENTER); return contentPanel1; }
private void initComponents() { splitPaneMain = new javax.swing.JSplitPane(); // // splitPanel = new javax.swing.JSplitPane(); splitPanelLeft = new javax.swing.JSplitPane(); graphOptionsPanel = new javax.swing.JPanel(); graphPanel = new javax.swing.JPanel(); rightPanel = new javax.swing.JPanel(); generalPanel = new javax.swing.JPanel(); nameTextField = new javax.swing.JTextField(); labelForName = new javax.swing.JLabel(); blocksPanel = new javax.swing.JPanel(); addBlockButton = new javax.swing.JButton(); removeBlockButton = new javax.swing.JButton(); adjustBlockButton = new javax.swing.JButton(); portsPanel = new javax.swing.JPanel(); addPortButton = new javax.swing.JButton(); removePortButton = new javax.swing.JButton(); adjustPortButton = new javax.swing.JButton(); blockRelationsPanel = new javax.swing.JPanel(); addRelationButton = new javax.swing.JButton(); removeRelationButton = new javax.swing.JButton(); splitPanelLeft.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); graphOptionsPanel.setLayout( new javax.swing.BoxLayout(graphOptionsPanel, javax.swing.BoxLayout.PAGE_AXIS)); topOptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Mouse Mode")); graphOptionsPanel.add(topOptionsPanel); bottomOptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Layout")); graphOptionsPanel.add(bottomOptionsPanel); gm = new DefaultModalGraphMouse(); JComboBox modeBox = gm.getModeComboBox(); topOptionsPanel.add(modeBox); PortConnections pconnsInst = PortConnections.getInstance(); vv = new VisualizationViewer(new CircleLayout(pconnsInst)); // create the transformers // edge label final Transformer edgeLabel = new Transformer() { public String transform(Object obj) { if (obj instanceof InteractionArc) { InteractionArc arc = (InteractionArc) obj; return arc.getArcStateShort(); } return "unknown"; } }; this.edgeLabel = edgeLabel; vv.getRenderContext().setEdgeLabelTransformer(edgeLabel); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); // options java.util.List<String> options = new ArrayList<String>(); options.add("FRLayout"); options.add("KKLayout"); options.add("CircleLayout"); options.add("SpringLayout"); options.add("SpringLayout2"); options.add("ISOMLayout"); layoutBox = new JComboBox(options.toArray()); layoutBox.setSelectedItem(options.get(0)); layoutBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { InteractionGraphs igraphs = InteractionGraphs.getInstance(); InteractionGraph graph = igraphs.getGraph(emidSelected); String selected = (String) ((JComboBox) e.getSource()).getSelectedItem(); if (selected.equals("FRLayout")) { vv = new VisualizationViewer(new FRLayout(graph)); } else if (selected.equals("KKLayout")) { vv = new VisualizationViewer(new KKLayout(graph)); } else if (selected.equals("CircleLayout")) { vv = new VisualizationViewer(new CircleLayout(graph)); } else if (selected.equals("SpringLayout")) { vv = new VisualizationViewer(new SpringLayout(graph)); } else if (selected.equals("SpringLayout2")) { vv = new VisualizationViewer(new SpringLayout2(graph)); } else if (selected.equals("ISOMLayout")) { vv = new VisualizationViewer(new ISOMLayout(graph)); } vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); vv.getRenderContext().setEdgeLabelTransformer(edgeLabel); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); setVisualizationViewer(vv); } }); layoutBox.setSelectedItem("CircleLayout"); bottomOptionsPanel.add(layoutBox); splitPanelLeft.setTopComponent(graphOptionsPanel); javax.swing.GroupLayout graphPanelLayout = new javax.swing.GroupLayout(graphPanel); graphPanel.setLayout(graphPanelLayout); graphPanelLayout.setHorizontalGroup( graphPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 181, Short.MAX_VALUE)); graphPanelLayout.setVerticalGroup( graphPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 432, Short.MAX_VALUE)); // splitPanelLeft.setRightComponent(graphPanel); splitPaneMain.setLeftComponent(splitPanelLeft); rightPanel.setLayout(new javax.swing.BoxLayout(rightPanel, javax.swing.BoxLayout.PAGE_AXIS)); generalPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("General")); labelForName.setText("name"); nameTextField.setText("new"); javax.swing.GroupLayout generalPanelLayout = new javax.swing.GroupLayout(generalPanel); generalPanel.setLayout(generalPanelLayout); generalPanelLayout.setHorizontalGroup( generalPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( generalPanelLayout .createSequentialGroup() .addContainerGap() .addComponent(labelForName) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(140, Short.MAX_VALUE))); generalPanelLayout.setVerticalGroup( generalPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( generalPanelLayout .createSequentialGroup() .addGroup( generalPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(labelForName) .addComponent( nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(96, Short.MAX_VALUE))); rightPanel.add(generalPanel); blocksPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Blocks")); javax.swing.GroupLayout blocksPanelLayout = new javax.swing.GroupLayout(blocksPanel); blocksPanel.setLayout(blocksPanelLayout); blocksPanelLayout.setHorizontalGroup( blocksPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( blocksPanelLayout .createSequentialGroup() .addGap(179, 179, 179) .addGroup( blocksPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent( adjustBlockButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( removeBlockButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( addBlockButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE)) .addContainerGap(158, Short.MAX_VALUE))); blocksPanelLayout.setVerticalGroup( blocksPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( blocksPanelLayout .createSequentialGroup() .addComponent(addBlockButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(removeBlockButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(adjustBlockButton) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); rightPanel.add(blocksPanel); portsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Ports")); javax.swing.GroupLayout portsPanelLayout = new javax.swing.GroupLayout(portsPanel); portsPanel.setLayout(portsPanelLayout); portsPanelLayout.setHorizontalGroup( portsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( portsPanelLayout .createSequentialGroup() .addGap(177, 177, 177) .addGroup( portsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent( adjustPortButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( removePortButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( addPortButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)) .addContainerGap(159, Short.MAX_VALUE))); portsPanelLayout.setVerticalGroup( portsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( portsPanelLayout .createSequentialGroup() .addComponent(addPortButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(removePortButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(adjustPortButton) .addContainerGap(32, Short.MAX_VALUE))); rightPanel.add(portsPanel); blockRelationsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Block Relations")); javax.swing.GroupLayout blockRelationsPanelLayout = new javax.swing.GroupLayout(blockRelationsPanel); blockRelationsPanel.setLayout(blockRelationsPanelLayout); blockRelationsPanelLayout.setHorizontalGroup( blockRelationsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( blockRelationsPanelLayout .createSequentialGroup() .addGap(177, 177, 177) .addGroup( blockRelationsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent( removeRelationButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( addRelationButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE)) .addContainerGap(159, Short.MAX_VALUE))); blockRelationsPanelLayout.setVerticalGroup( blockRelationsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( blockRelationsPanelLayout .createSequentialGroup() .addComponent(addRelationButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(removeRelationButton) .addContainerGap(61, Short.MAX_VALUE))); rightPanel.add(blockRelationsPanel); splitPaneMain.setRightComponent(rightPanel); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( splitPaneMain, javax.swing.GroupLayout.DEFAULT_SIZE, 653, Short.MAX_VALUE)); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( splitPaneMain, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)); }
// <editor-fold defaultstate="collapsed" desc=" Generated Code // <editor-fold defaultstate="collapsed" // desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { javax.swing.JPanel statusPanel = new javax.swing.JPanel(); lblUserName = new javax.swing.JLabel(); javax.swing.JPanel bottomPanel = new javax.swing.JPanel(); javax.swing.JPanel bottomLeftPanel = new javax.swing.JPanel(); openTicketList = new com.floreantpos.ui.TicketListView(); javax.swing.JPanel activityPanel = new javax.swing.JPanel(); btnNewTicket = new com.floreantpos.swing.PosButton(); btnEditTicket = new com.floreantpos.swing.PosButton(); btnVoidTicket = new com.floreantpos.swing.PosButton(); btnPayout = new com.floreantpos.swing.PosButton(); btnOrderInfo = new com.floreantpos.swing.PosButton(); javax.swing.JPanel bottomRightPanel = new javax.swing.JPanel(); btnShutdown = new com.floreantpos.swing.PosButton(); btnLogout = new com.floreantpos.swing.PosButton(); btnBackOffice = new com.floreantpos.swing.PosButton(); btnSalesReport = new com.floreantpos.swing.PosButton(); btnManager = new com.floreantpos.swing.PosButton(); btnClockOut = new com.floreantpos.swing.PosButton(); setLayout(new java.awt.BorderLayout(10, 10)); lblUserName.setFont(new java.awt.Font("Tahoma", 1, 18)); lblUserName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); statusPanel.add(lblUserName, java.awt.BorderLayout.PAGE_START); add(statusPanel, java.awt.BorderLayout.NORTH); bottomPanel.setLayout(new java.awt.BorderLayout(5, 5)); bottomLeftPanel.setBorder( javax.swing.BorderFactory.createTitledBorder( null, POSConstants.OPEN_TICKETS_AND_ACTIVITY, javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION)); bottomLeftPanel.setLayout(new java.awt.BorderLayout(5, 5)); bottomLeftPanel.add(openTicketList, java.awt.BorderLayout.CENTER); activityPanel.setPreferredSize(new java.awt.Dimension(655, 150)); activityPanel.setLayout(new java.awt.GridLayout(3, 0, 5, 5)); btnNewTicket.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/new_ticket_32.png"))); btnNewTicket.setText(POSConstants.DINE_IN); activityPanel.add(btnNewTicket); btnTakeout = new com.floreantpos.swing.PosButton(); btnTakeout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/take_away.png"))); btnTakeout.setText(POSConstants.CAPITAL_TAKE_OUT); activityPanel.add(btnTakeout); // btnPickup = new PosButton(); // btnPickup.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // doHomeDelivery(Ticket.PICKUP); // } // }); // btnPickup.setText(POSConstants.PICKUP); // activityPanel.add(btnPickup); // btnHomeDelivery = new PosButton(); // btnHomeDelivery.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // doHomeDelivery(Ticket.HOME_DELIVERY); // } // }); // btnHomeDelivery.setText(POSConstants.HOME_DELIVERY); // activityPanel.add(btnHomeDelivery); /* btnDriveThrough = new PosButton(); btnDriveThrough.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doTakeout(Ticket.DRIVE_THROUGH); } }); btnDriveThrough.setText(POSConstants.DRIVE_THRU); activityPanel.add(btnDriveThrough); */ btnEditTicket.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/edit_ticket_32.png"))); btnEditTicket.setText(POSConstants.CAPITAL_EDIT); activityPanel.add(btnEditTicket); btnSettleTicket = new com.floreantpos.swing.PosButton(); btnSettleTicket.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/settle_ticket_32.png"))); btnSettleTicket.setText(POSConstants.CAPITAL_SETTLE); activityPanel.add(btnSettleTicket); if (!"false".equals(AppConfig.getFeatureGroupTicketFlag())) { btnGroupSettle = new com.floreantpos.swing.PosButton(); btnGroupSettle.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/settle_ticket_32.png"))); btnGroupSettle.setText( "<html><body>" + POSConstants.CAPITAL_SETTLE + "<br>" + POSConstants.CAPITAL_GROUP + "</body></html>"); activityPanel.add(btnGroupSettle); } if (!"false".equals(AppConfig.getFeatureSplitTicketFlag())) { btnSplitTicket = new com.floreantpos.swing.PosButton(); btnSplitTicket.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/split_32.png"))); btnSplitTicket.setText(POSConstants.CAPITAL_SPLIT); activityPanel.add(btnSplitTicket); } btnReopenTicket = new com.floreantpos.swing.PosButton(); btnReopenTicket.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/edit_ticket_32.png"))); btnReopenTicket.setText(POSConstants.CAPITAL_RE_OPEN); activityPanel.add(btnReopenTicket); btnVoidTicket.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/void_ticket_32.png"))); btnVoidTicket.setText(POSConstants.CAPITAL_VOID); activityPanel.add(btnVoidTicket); if (!"false".equals(AppConfig.getFeaturePenarikanFlag())) { btnPayout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/pay_32.png"))); btnPayout.setText(POSConstants.CAPITAL_PAY_OUT); activityPanel.add(btnPayout); } btnOrderInfo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/search.png"))); btnOrderInfo.setText(POSConstants.ORDER_INFO); activityPanel.add(btnOrderInfo); bottomLeftPanel.add(activityPanel, java.awt.BorderLayout.SOUTH); // btnAssignDriver = new PosButton(); // btnAssignDriver.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // doAssignDriver(); // } // }); // btnAssignDriver.setText("<html>PILIH<br/>PENGANTAR</html>"); // activityPanel.add(btnAssignDriver); // // btnCloseOrder = new PosButton(); // btnCloseOrder.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // doCloseOrder(); // } // }); // btnCloseOrder.setText(POSConstants.CLOSE_ORDER); // activityPanel.add(btnCloseOrder); bottomPanel.add(bottomLeftPanel, java.awt.BorderLayout.CENTER); bottomRightPanel.setBorder( javax.swing.BorderFactory.createTitledBorder( null, "LAIN-LAIN", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION)); bottomRightPanel.setPreferredSize(new java.awt.Dimension(180, 10)); btnShutdown.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/shut_down_32.png"))); btnShutdown.setText(POSConstants.CAPITAL_SHUTDOWN); btnLogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/log_out_32.png"))); btnLogout.setText(POSConstants.CAPITAL_LOGOUT); btnBackOffice.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/back_office.png"))); btnBackOffice.setText(POSConstants.CAPITAL_BACK_OFFICE); btnSalesReport.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/salesreport.png"))); btnSalesReport.setText(POSConstants.CAPITAL_SALES_REPORT); if (!"false".equalsIgnoreCase(AppConfig.getManagerMenuFlag())) { btnManager.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/user_32.png"))); btnManager.setText(POSConstants.CAPITAL_MANAGER); } btnClockOut.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/log_out_32.png"))); btnClockOut.setText(POSConstants.CAPITAL_CLOCK_OUT); bottomPanel.add(bottomRightPanel, java.awt.BorderLayout.EAST); bottomRightPanel.setLayout( new MigLayout("aligny bottom, insets 1 2 1 2, gapy 10", "[170px]", "[][][][][]")); bottomRightPanel.add(btnShutdown, "cell 0 5,grow"); bottomRightPanel.add(btnLogout, "cell 0 4,grow"); bottomRightPanel.add(btnSalesReport, "cell 0 3,grow"); bottomRightPanel.add(btnClockOut, "cell 0 2,grow"); bottomRightPanel.add(btnBackOffice, "cell 0 1,grow"); if (!"false".equalsIgnoreCase(AppConfig.getManagerMenuFlag())) { bottomRightPanel.add(btnManager, "cell 0 0,grow"); } add(bottomPanel, java.awt.BorderLayout.CENTER); } // </editor-fold>//GEN-END:initComponents
public NumbrixGUI() throws ParseException { // Board gameBoard) throws ParseException{ // Board this.gameBoard = new Board(); // Container setTitle(TITLE); setSize(WIDTH, HEIGHT); setDefaultCloseOperation(EXIT_ON_CLOSE); // About Frame jFrameAbout = new javax.swing.JFrame(); jFrameAbout.setResizable(false); jFrameAbout.setPreferredSize(new Dimension(500, 300)); jTextAreaAbout = new javax.swing.JTextArea(); jTextAreaAbout.setBackground(new java.awt.Color(240, 240, 240)); jTextAreaAbout.setColumns(20); jTextAreaAbout.setRows(10); jTextAreaAbout.setText( "\t\tNumbrix Version 1\n\nClass Project for Artificial Intelligence course.\nUniversity of Florida\nCISE\n\n\n\n\nby Rainer Ledesma\nhttp://www.cise.ufl.edu/~rledesma/\n"); jTextAreaAbout.setFont(new java.awt.Font("Agency FB", 1, 20)); // NOI18N jTextAreaAbout.setEditable(false); jTextAreaAbout.setPreferredSize(new Dimension(500, 300)); javax.swing.GroupLayout jFrameAboutLayout = new javax.swing.GroupLayout(jFrameAbout.getContentPane()); jFrameAbout.getContentPane().setLayout(jFrameAboutLayout); jFrameAboutLayout.setHorizontalGroup( jFrameAboutLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameAboutLayout .createSequentialGroup() .addGap(11, 11, 11) .addComponent( jTextAreaAbout, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jFrameAboutLayout.setVerticalGroup( jFrameAboutLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameAboutLayout .createSequentialGroup() .addGap(0, 16, Short.MAX_VALUE) .addComponent( jTextAreaAbout, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 17, Short.MAX_VALUE))); // // Instructions Frame jFrameInstructions = new javax.swing.JFrame(); jFrameInstructions.setResizable(false); jFrameInstructions.setPreferredSize(new Dimension(500, 300)); jTextAreaInstructions = new javax.swing.JTextArea(); jTextAreaInstructions.setBackground(new java.awt.Color(240, 240, 240)); jTextAreaInstructions.setColumns(20); jTextAreaInstructions.setRows(10); jTextAreaInstructions.setText( "\t\tNumbrix\n" + "The object of Numbrix is to fill the board with sequence of consecutive \n" + "numbers from 1 to the maximun cell count. The numbers must fillow a \n" + "horizontal or vertical path (no diagonals)\n"); jTextAreaInstructions.setFont(new java.awt.Font("Agency FB", 1, 20)); // NOI18N jTextAreaInstructions.setEditable(false); jTextAreaInstructions.setPreferredSize(new Dimension(500, 300)); javax.swing.GroupLayout jFrameInstructionsLayout = new javax.swing.GroupLayout(jFrameInstructions.getContentPane()); jFrameInstructions.getContentPane().setLayout(jFrameInstructionsLayout); jFrameInstructionsLayout.setHorizontalGroup( jFrameInstructionsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameInstructionsLayout .createSequentialGroup() .addGap(11, 11, 11) .addComponent( jTextAreaInstructions, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jFrameInstructionsLayout.setVerticalGroup( jFrameInstructionsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameInstructionsLayout .createSequentialGroup() .addGap(0, 16, Short.MAX_VALUE) .addComponent( jTextAreaInstructions, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 17, Short.MAX_VALUE))); // // File Chooser jFrameFileChooser = new javax.swing.JFrame(); jFileChooser = new javax.swing.JFileChooser(); jFileChooser.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { try { jFileChooserActionPerformed(evt); } catch (Exception ex) { JOptionPane.showMessageDialog(frame, "File Exception"); } } }); javax.swing.GroupLayout jFrameFileChooserLayout = new javax.swing.GroupLayout(jFrameFileChooser.getContentPane()); jFrameFileChooser.getContentPane().setLayout(jFrameFileChooserLayout); jFrameFileChooserLayout.setHorizontalGroup( jFrameFileChooserLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 618, Short.MAX_VALUE) .addGroup( jFrameFileChooserLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameFileChooserLayout .createSequentialGroup() .addGap(18, 18, 18) .addComponent( jFileChooser, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18)))); jFrameFileChooserLayout.setVerticalGroup( jFrameFileChooserLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 456, Short.MAX_VALUE) .addGroup( jFrameFileChooserLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jFrameFileChooserLayout .createSequentialGroup() .addGap(27, 27, 27) .addComponent( jFileChooser, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(32, 32, 32)))); // // SidePanel jPanelSideBar = new javax.swing.JPanel(); jButtonRESET = new javax.swing.JButton(); jButtonSOLVE = new javax.swing.JButton(); jButtonNEWGAME = new javax.swing.JButton(); jLabelTIMER = new javax.swing.JLabel(); jButtonPAUSE = new javax.swing.JButton(); jButtonRESET.setText("RESET"); jButtonRESET.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonRESETActionPerformed(evt); } }); jButtonSOLVE.setText("SOLVE"); jButtonSOLVE.setEnabled(false); jButtonSOLVE.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { try { jButtonSOLVEActionPerformed(evt); } catch (IOException ex) { Logger.getLogger(NumbrixGUI.class.getName()).log(Level.SEVERE, null, ex); } } }); jButtonNEWGAME.setText("NEW GAME"); jButtonNEWGAME.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonNEWGAMEActionPerformed(evt); } }); jLabelTIMER.setText("TIMER"); jLabelTIMER.setFont(new java.awt.Font("Agency FB", 1, 18)); jButtonPAUSE.setText("PAUSE"); jButtonPAUSE.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonPAUSEActionPerformed(evt); } }); jLabelClock = new javax.swing.JLabel(); jLabelClock.setFont(new java.awt.Font("Agency FB", 1, 24)); // NOI18N jLabelClock.setText("10 : 99 : 60"); javax.swing.GroupLayout jPanelSideBarLayout = new javax.swing.GroupLayout(jPanelSideBar); jPanelSideBar.setLayout(jPanelSideBarLayout); jPanelSideBarLayout.setHorizontalGroup( jPanelSideBarLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanelSideBarLayout .createSequentialGroup() .addContainerGap() .addGroup( jPanelSideBarLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jButtonRESET, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jButtonSOLVE, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jButtonNEWGAME, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE) .addComponent( jButtonPAUSE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( jPanelSideBarLayout .createSequentialGroup() .addGroup( jPanelSideBarLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabelTIMER) .addComponent( jLabelClock, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); jPanelSideBarLayout.setVerticalGroup( jPanelSideBarLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, jPanelSideBarLayout .createSequentialGroup() .addContainerGap() .addComponent(jLabelTIMER) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( jLabelClock, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButtonPAUSE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 229, Short.MAX_VALUE) .addComponent(jButtonNEWGAME) .addGap(18, 18, 18) .addComponent(jButtonRESET) .addGap(18, 18, 18) .addComponent(jButtonSOLVE) .addContainerGap())); //////// // Menu jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItemNewGame = new javax.swing.JMenuItem(); jMenuItemExit = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenuItemInstructions = new javax.swing.JMenuItem(); jMenuItemAbout = new javax.swing.JMenuItem(); jMenu1.setText("File"); jMenu2.setText("Edit"); jMenuItemNewGame.setText("New Game"); jMenuItemExit.setText("Exit"); jMenuItemInstructions.setText("Instructions"); jMenuItemAbout.setText("About Numbrix"); jMenuBar1.add(jMenu1); jMenuBar1.add(jMenu2); jMenu1.add(jMenuItemNewGame); jMenu1.add(jMenuItemExit); jMenu2.add(jMenuItemInstructions); jMenu2.add(jMenuItemAbout); setJMenuBar(jMenuBar1); jMenuItemNewGame.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemNewGameActionPerformed(evt); } }); jMenuItemExit.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemExitActionPerformed(evt); } }); jMenuItemInstructions.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemInstructionsActionPerformed(evt); } }); jMenuItemAbout.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemAboutActionPerformed(evt); } }); // // SolvedBoardPanel jPanelSolvedBoard = new javax.swing.JPanel(); jPanelSolvedBoard.setBackground(new java.awt.Color(255, 255, 255)); // Solved Board Frame jFrameSolvedBoard = new javax.swing.JFrame(); jFrameSolvedBoard.setTitle("Numbrix Solution"); javax.swing.GroupLayout jFrameSolvedBoardLayout = new javax.swing.GroupLayout(jFrameSolvedBoard.getContentPane()); jFrameSolvedBoard.getContentPane().setLayout(jFrameSolvedBoardLayout); jFrameSolvedBoardLayout.setHorizontalGroup( jFrameSolvedBoardLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) .addGroup( jFrameSolvedBoardLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jPanelSolvedBoard, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE))); jFrameSolvedBoardLayout.setVerticalGroup( jFrameSolvedBoardLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) .addGroup( jFrameSolvedBoardLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jPanelSolvedBoard, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE))); // BoardPanel boardPanel = new javax.swing.JPanel(); boardPanel.setBackground(new java.awt.Color(255, 255, 255)); // Clock gameTimer = new GameTimer(jLabelClock); this.gameTimer.start(); this.gameTimer.run(); // Initialize // init(); // Container Layout javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap() .addComponent( boardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent( jPanelSideBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent( boardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jPanelSideBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); }
private void jButtonSOLVEActionPerformed(java.awt.event.ActionEvent evt) throws IOException { System.out.println("solving"); // DEBUG // BufferedReader in = new BufferedReader(new // FileReader("C:\\Users\\Rainer\\Desktop\\2013 FALL\\CAP 4621 - Artificial // Intelligence\\Project\\InitialBoard.txt")); // // try{ // in = new BufferedReader(new FileReader("C:\\Users\\Rainer\\Desktop\\2013 // FALL\\CAP 4621 - Artificial Intelligence\\Project\\InitialBoard.txt")); // // }catch (FileNotFoundException e){ // System.out.println(e.getCause()); // System.out.println("Error loading initial board"); // } // // int [] boardRows = new int [15]; // // //---------------- // String text = in.readLine(); // // StringTokenizer tokenizer = new StringTokenizer(text," "); // // int boardSize = 0; // while (tokenizer.hasMoreElements()){ // boardRows[boardSize] = Integer.parseInt(tokenizer.nextToken()); // boardSize++; // } // // int []newBoard = new int[boardSize*boardSize+1]; // System.arraycopy(boardRows, 0, newBoard, 1, boardSize); // // int index = 0; // while (in.ready()) { // index++; // text = in.readLine(); // // tokenizer = new StringTokenizer(text," "); // int pos = 0; // while (tokenizer.hasMoreElements()){ // pos++; // newBoard[index*boardSize+pos] = // Integer.parseInt(tokenizer.nextToken()); // } // } // // this.jFrameFileChooser.setVisible(false); // // this.boardPanel.s // // gameInitialBoard = new Board(newBoard, boardSize); // gameBoard = new Board(newBoard, boardSize); // init(); // // END DEBUG long startTime = System.nanoTime(); this.gameBoard.solveBoard(); long endTime = System.nanoTime(); double time = (endTime - startTime) / 100000000.0; System.out.println("Excecution time: " + time + " seconds"); // jPanelSolvedBoard jPanelSolvedBoard.removeAll(); jPanelSolvedBoard.setLayout( new GridLayout(gameBoard.boardSize, gameBoard.boardSize)); // Set layout solvedCells = new JTextField[gameBoard.boardSize * gameBoard.boardSize + 1]; for (int i = 1; i <= gameBoard.boardSize * gameBoard.boardSize; i++) { solvedCells[i] = new JTextField(); solvedCells[i].setHorizontalAlignment(JTextField.CENTER); solvedCells[i].setFont(new Font("Agency FB", Font.BOLD, 24)); // Add elements to the grid content pane jPanelSolvedBoard.add(solvedCells[i]); String ch = Integer.toString(this.gameBoard.cells[i]); solvedCells[i].setText(ch); solvedCells[i].setEditable(false); } // gameBoard.out(); jPanelSolvedBoard.setVisible(true); this.jPanelSolvedBoard.repaint(); this.jFrameSolvedBoard.setVisible(true); this.jFrameSolvedBoard.pack(); // }