public JDesktopPane getJDesktopPane(JFrame frame) { if (jDesktopPane == null || this.frame != frame) { this.frame = frame; jDesktopPane = new JDesktopPane(); jDesktopPane.setBackground(new Color(128, 128, 255)); transformToInternalFrame(frame, jDesktopPane); } return jDesktopPane; }
public void init(String title, String projeto) { applicationContext = new ClassPathXmlApplicationContext( "classpath:/" + projeto + ".xml", "classpath:/applicationContext.xml"); this.setTitle(title); this.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent we) { if (logger.isDebugEnabled()) { System.exit(0); } if (MkDialog.confirm("Sair do sistema?")) { System.exit(0); } } }); this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); this.setSize(1000, 800); if (logger.isDebugEnabled()) { this.setLocation(400, 300); } else { this.setExtendedState(JFrame.MAXIMIZED_BOTH); } this.setLayout(new BorderLayout()); this.getContentPane().add(desktopPane, BorderLayout.CENTER); desktopPane.setBackground(Color.WHITE); try { Properties largeFontProps = new Properties(); largeFontProps.setProperty("controlTextFont", "Dialog 14"); largeFontProps.setProperty("systemTextFont", "Dialog 14"); largeFontProps.setProperty("userTextFont", "Dialog 14"); largeFontProps.setProperty("menuTextFont", "Dialog 14"); largeFontProps.setProperty("windowTitleFont", "Dialog bold 14"); largeFontProps.setProperty("subTextFont", "Dialog 12"); AluminiumLookAndFeel.setTheme(largeFontProps); UIManager.setLookAndFeel(com.jtattoo.plaf.aluminium.AluminiumLookAndFeel.class.getName()); InputMap im = (InputMap) UIManager.getDefaults().get("Button.focusInputMap"); // Enter button Object pressedAction = im.get(KeyStroke.getKeyStroke("pressed SPACE")); Object releasedAction = im.get(KeyStroke.getKeyStroke("released SPACE")); im.put(KeyStroke.getKeyStroke("pressed ENTER"), pressedAction); im.put(KeyStroke.getKeyStroke("released ENTER"), releasedAction); SwingUtilities.updateComponentTreeUI(instance); } catch (Exception ex) { } this.setVisible(true); }
public MapEditor(LocalSettings localSettings) throws HeadlessException { setTitle(TITLE); setSize(WIDTH, HEIGHT); this.localSettings = localSettings; mainpane = new JDesktopPane(); mainpane.setSize(WIDTH, HEIGHT); mainpane.setBackground(Color.GRAY); setContentPane(mainpane); LwjglApplicationConfiguration configuration = new LwjglApplicationConfiguration(); configuration.width = WIDTH; configuration.height = HEIGHT; levelHolder = new LevelHolder(); final LwjglCanvas lwjglCanvas = new LwjglCanvas(levelHolder, configuration); canvas = lwjglCanvas; levelHolderFrame = new JInternalFrame("EnJine2D Map", false, false, false, true); levelHolderFrame.setSize(WIDTH, HEIGHT); levelHolderFrame.setVisible(true); palette = new Palette("Palette", true, false, true, true); palette.setVisible(true); palette.setLevelHolder(levelHolder); levelHolder.setPalette(palette); getContentPane().add(palette); getContentPane().add(levelHolderFrame); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { levelHolderFrame.getContentPane().add(lwjglCanvas.getCanvas()); setVisible(true); } }); loadSettings(); levelHolderFrame.addComponentListener(this); palette.addComponentListener(this); addWindowListener(this); }
/** * Creates the main view of the Daycare Management System program and displays it to the user. * * @param t The title of the program to be displayed in the frame * @param d The dimensions of the frame/window (width, height) * @param i The Image to be displayed in the user's "explorer" bar or "dock" */ private void createAndShowGUI(String t, Dimension d, ImageIcon i) { f = new JFrame(); desktop = new JDesktopPane(); // Initialize a JDesktopPane where we will be adding the // JInternalFrame's desktop.setBackground(new Color(200, 200, 200)); // Set the background color of the JDesktopPane contentPane = f.getContentPane(); /* * Add components to JFrame */ f.setJMenuBar(menuBar()); contentPane.add(toolBar(), BorderLayout.NORTH); contentPane.add(desktop); f.setTitle(t); f.setSize(d); f.setMinimumSize(d); if (i != null) f.setIconImage(i.getImage()); // 64 x 64 f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
protected void installDefaults() { if (desktop.getBackground() == null || desktop.getBackground() instanceof UIResource) { desktop.setBackground(UIManager.getColor("Desktop.background")); } LookAndFeel.installProperty(desktop, "opaque", Boolean.TRUE); }
/** * metoda odpowiedzialna za stworzenie grafiki z odpowiednim wypelnieniem pol i actionListenery */ public void ZbudujGraf() throws IOException { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 0, 600, 700); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JLabel labelGlowny = new JLabel(" Dzienniczek Ucznia"); labelGlowny.setFont(new Font("Serif", Font.PLAIN, 50)); contentPane.add(labelGlowny, BorderLayout.NORTH); JLabel label = new JLabel(""); contentPane.add(label, BorderLayout.WEST); desktopPane = new JDesktopPane(); desktopPane.setBackground(SystemColor.menu); contentPane.add(desktopPane, BorderLayout.CENTER); lblMatematyka = new JLabel("Matematyka"); lblMatematyka.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblMatematyka.setBounds(10, 10, 113, 39); desktopPane.add(lblMatematyka); lblPolski = new JLabel("J\u0119zyk polski"); lblPolski.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblPolski.setBounds(10, 40, 113, 39); desktopPane.add(lblPolski); lblHistoria = new JLabel("Historia"); lblHistoria.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblHistoria.setBounds(10, 70, 113, 39); desktopPane.add(lblHistoria); lblFizyka = new JLabel("Fizyka"); lblFizyka.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblFizyka.setBounds(10, 100, 113, 39); desktopPane.add(lblFizyka); lblChemia = new JLabel("Chemia"); // lblChemia.setForeground(Color.BLACK); lblChemia.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblChemia.setBounds(10, 130, 113, 39); desktopPane.add(lblChemia); lblBiologia = new JLabel("Biologia"); lblBiologia.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblBiologia.setBounds(10, 160, 113, 39); desktopPane.add(lblBiologia); lblAngielski = new JLabel("Angielski"); lblAngielski.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblAngielski.setBounds(10, 190, 113, 39); desktopPane.add(lblAngielski); lblNiemiecki = new JLabel("Niemiecki"); lblNiemiecki.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblNiemiecki.setBounds(10, 220, 113, 39); desktopPane.add(lblNiemiecki); lblGeografia = new JLabel("Geografia"); lblGeografia.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblGeografia.setBounds(10, 250, 113, 39); desktopPane.add(lblGeografia); lblInformatyka = new JLabel("Informatyka"); lblInformatyka.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblInformatyka.setBounds(10, 280, 113, 39); desktopPane.add(lblInformatyka); lblWos = new JLabel("WoS"); lblWos.setFont(new Font("Tahoma", Font.PLAIN, 17)); lblWos.setBounds(10, 310, 113, 39); desktopPane.add(lblWos); btn_Mat = new JButton(""); btn_Mat.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "Matematyka"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_Mat.setOpaque(false); btn_Mat.setFocusPainted(false); btn_Mat.setContentAreaFilled(false); btn_Mat.setBorderPainted(false); btn_Mat.setBounds(252, 10, 285, 39); desktopPane.add(btn_Mat); btn_Pol = new JButton(""); btn_Pol.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "Polski"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_Pol.setOpaque(false); btn_Pol.setFocusPainted(false); btn_Pol.setContentAreaFilled(false); btn_Pol.setBorderPainted(false); btn_Pol.setBounds(252, 40, 285, 39); desktopPane.add(btn_Pol); btn_His = new JButton(""); btn_His.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "Historia"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_His.setOpaque(false); btn_His.setFocusPainted(false); btn_His.setContentAreaFilled(false); btn_His.setBorderPainted(false); btn_His.setBounds(252, 70, 285, 39); desktopPane.add(btn_His); btn_Fiz = new JButton(""); btn_Fiz.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "Fizyka"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_Fiz.setOpaque(false); btn_Fiz.setFocusPainted(false); btn_Fiz.setContentAreaFilled(false); btn_Fiz.setBorderPainted(false); btn_Fiz.setBounds(252, 100, 285, 39); desktopPane.add(btn_Fiz); btn_Che = new JButton(""); btn_Che.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "Chemia"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_Che.setOpaque(false); btn_Che.setFocusPainted(false); btn_Che.setContentAreaFilled(false); btn_Che.setBorderPainted(false); btn_Che.setBounds(252, 130, 285, 39); desktopPane.add(btn_Che); btn_Bio = new JButton(""); btn_Bio.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "Biologia"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_Bio.setOpaque(false); btn_Bio.setFocusPainted(false); btn_Bio.setContentAreaFilled(false); btn_Bio.setBorderPainted(false); btn_Bio.setBounds(252, 160, 285, 39); desktopPane.add(btn_Bio); btn_Ang = new JButton(""); btn_Ang.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "Angielski"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_Ang.setOpaque(false); btn_Ang.setFocusPainted(false); btn_Ang.setContentAreaFilled(false); btn_Ang.setBorderPainted(false); btn_Ang.setBounds(252, 190, 285, 39); desktopPane.add(btn_Ang); btn_Niem = new JButton(""); btn_Niem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "Niemiecki"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_Niem.setOpaque(false); btn_Niem.setFocusPainted(false); btn_Niem.setContentAreaFilled(false); btn_Niem.setBorderPainted(false); btn_Niem.setBounds(252, 220, 285, 39); desktopPane.add(btn_Niem); btn_Geo = new JButton(""); btn_Geo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "Geografia"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_Geo.setOpaque(false); btn_Geo.setFocusPainted(false); btn_Geo.setContentAreaFilled(false); btn_Geo.setBorderPainted(false); btn_Geo.setBounds(252, 250, 285, 39); desktopPane.add(btn_Geo); btn_Inf = new JButton(""); btn_Inf.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "Informatyka"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_Inf.setOpaque(false); btn_Inf.setFocusPainted(false); btn_Inf.setContentAreaFilled(false); btn_Inf.setBorderPainted(false); btn_Inf.setBounds(252, 280, 285, 39); desktopPane.add(btn_Inf); btn_Wos = new JButton(""); btn_Wos.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { przedmiot = "WoS"; SzczegolyOcen.main(null); closelButtonActionPerformed(e); } }); btn_Wos.setOpaque(false); btn_Wos.setFocusPainted(false); btn_Wos.setContentAreaFilled(false); btn_Wos.setBorderPainted(false); btn_Wos.setBounds(252, 310, 285, 39); desktopPane.add(btn_Wos); }
public MainWindow() { JMenuItem showTextItem, showContentItem, showStatsItem; JMenuItem consoleWinItem, treeWinItem, traceWinItem; // our libgist execution thread opThread = new OpThread(this); Libgist.setBreakHandler(opThread); opThread.start(); cmd = new LibgistCommand(); menuBar = new JMenuBar(); setJMenuBar(menuBar); // create toolbar and console window with text area getContentPane().removeAll(); getContentPane().setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); // desktop pane + console frame desktop = new JDesktopPane(); desktop.setOpaque(true); desktop.setBackground(Color.lightGray); consoleFrame = new ConsoleWindow(200, desktop); desktop.add(consoleFrame, JLayeredPane.PALETTE_LAYER); // debugging actions for toolbar: // notify opThread of what to do when it hits a breakpoint stepAction = new AbstractAction("Step") { public void actionPerformed(ActionEvent e) { opThread.step(); } }; cancelAction = new AbstractAction("Cancel") { public void actionPerformed(ActionEvent e) { scriptWasCancelled = true; // don't call it after next line! opThread.cancel(); } }; nextAction = new AbstractAction("Next") { public void actionPerformed(ActionEvent e) { opThread.next(); } }; contAction = new AbstractAction("Continue") { public void actionPerformed(ActionEvent e) { opThread.cont(); } }; // opThread is currently executing a script and we want it to stop: // tell libgist directly to suspend execution once opThread is done // with the current operation stopAction = new AbstractAction("Stop") { public void actionPerformed(ActionEvent e) { Libgist.singleStep(); } }; // toolbar JToolBar toolbar = new JToolBar(); toolbar.add(stepAction).setText("Step"); toolbar.add(nextAction).setText("Next"); toolbar.add(contAction).setText("Continue"); toolbar.add(stopAction).setText("Stop"); toolbar.add(cancelAction).setText("Cancel"); panel.add(toolbar, BorderLayout.NORTH); panel.add(desktop, BorderLayout.CENTER); getContentPane().add(panel); createFileMenu(); createOpsMenu(); createDebugMenu(); createTreeStatsMenu(); createAnalysisMenu(); createWindowsMenu(); setGuiState(INITSTATE); // nothing opened yet // addWindowListener(this); // So we do the right thing on window closing. }
/** Create the frame. */ public mainframe_test() { setTitle("EXAM SYSTEM"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 709, 472); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new CardLayout(0, 0)); login = new JPanel(); contentPane.add(login, "login"); login.setLayout(null); JButton button = new JButton("STUDENT"); button.setFont(new Font("SimSun", Font.PLAIN, 22)); button.setBounds(425, 133, 146, 45); login.add(button); button.addActionListener(new PersonAction()); JButton btnInstructor = new JButton("INSTRUCTOR"); btnInstructor.setFont(new Font("SimSun", Font.PLAIN, 22)); btnInstructor.setBounds(425, 233, 146, 45); login.add(btnInstructor); btnInstructor.addActionListener(new teacherAction()); JLabel lblUcid = new JLabel("UCID"); lblUcid.setFont(new Font("SimSun", Font.PLAIN, 30)); lblUcid.setBounds(39, 101, 146, 32); login.add(lblUcid); textField = new JTextField(); textField.setFont(new Font("SimSun", Font.PLAIN, 30)); textField.setColumns(10); textField.setBounds(39, 146, 206, 32); login.add(textField); JLabel label_1 = new JLabel("OR"); label_1.setFont(new Font("SimSun", Font.PLAIN, 34)); label_1.setBounds(486, 191, 81, 32); login.add(label_1); JLabel label_2 = new JLabel("Password"); label_2.setFont(new Font("SimSun", Font.PLAIN, 30)); label_2.setBounds(39, 191, 146, 32); login.add(label_2); button_2 = new JButton("EXIT SYSTEM"); button_2.setFont(new Font("SimSun", Font.PLAIN, 30)); button_2.addActionListener(new button2()); button_2.setBounds(224, 329, 213, 45); login.add(button_2); JLabel label_3 = new JLabel(" Welcome to online exam system"); label_3.setFont(new Font("Arial", Font.BOLD, 38)); label_3.setBounds(0, 13, 677, 68); login.add(label_3); passwordField = new JPasswordField(); passwordField.setFont(new Font("SimSun", Font.PLAIN, 30)); passwordField.setBounds(39, 246, 206, 32); login.add(passwordField); student = new JPanel(); contentPane.add(student, "student"); student.setLayout(null); JDesktopPane desktopPane = new JDesktopPane(); desktopPane.setBackground(Color.WHITE); desktopPane.setBounds(0, 0, 681, 417); student.add(desktopPane); JLabel lblStudentId = new JLabel("UCID:"); lblStudentId.setHorizontalAlignment(SwingConstants.CENTER); lblStudentId.setFont(new Font("SimSun", Font.PLAIN, 24)); lblStudentId.setBounds(14, 0, 153, 40); desktopPane.add(lblStudentId); JPanel tree = new JPanel(); tree.setBackground(Color.WHITE); tree.setBounds(0, 36, 131, 381); desktopPane.add(tree); tree.setLayout(null); tree_1 = new JTree(); tree_1.setModel( new DefaultTreeModel( new DefaultMutableTreeNode("Index") { { DefaultMutableTreeNode node_1; node_1 = new DefaultMutableTreeNode("Questions"); node_1.add(new DefaultMutableTreeNode("1")); node_1.add(new DefaultMutableTreeNode("2")); node_1.add(new DefaultMutableTreeNode("3")); node_1.add(new DefaultMutableTreeNode("4")); node_1.add(new DefaultMutableTreeNode("5")); node_1.add(new DefaultMutableTreeNode("6")); node_1.add(new DefaultMutableTreeNode("7")); node_1.add(new DefaultMutableTreeNode("8")); node_1.add(new DefaultMutableTreeNode("9")); node_1.add(new DefaultMutableTreeNode("10")); getContentPane().add(node_1); getContentPane().add(new DefaultMutableTreeNode("Submit")); } })); tree_1.setBounds(14, 13, 103, 322); tree_1.addTreeSelectionListener( new javax.swing.event.TreeSelectionListener() { public void valueChanged(javax.swing.event.TreeSelectionEvent evt) { treeValueChanged(evt); } }); tree.add(tree_1); content = new JPanel(); content.setBounds(134, 36, 547, 381); desktopPane.add(content); content.setLayout(new CardLayout(0, 0)); ready = new JPanel(); content.add(ready, "ready"); ready.setLayout(null); JLabel lblTheExamsTotal = new JLabel("The exam's total time is 3 H."); lblTheExamsTotal.setHorizontalAlignment(SwingConstants.CENTER); lblTheExamsTotal.setFont(new Font("SimSun", Font.BOLD, 30)); lblTheExamsTotal.setBounds(25, 24, 508, 67); ready.add(lblTheExamsTotal); JLabel lblWishYouAll = new JLabel("Wish you all the best."); lblWishYouAll.setFont(new Font("SimSun", Font.BOLD, 30)); lblWishYouAll.setHorizontalAlignment(SwingConstants.CENTER); lblWishYouAll.setBounds(25, 106, 508, 67); ready.add(lblWishYouAll); JLabel lblReady = new JLabel("Ready?"); lblReady.setHorizontalAlignment(SwingConstants.CENTER); lblReady.setFont(new Font("SimSun", Font.BOLD, 30)); lblReady.setBounds(112, 186, 313, 67); ready.add(lblReady); JButton btnNewButton = new JButton("Go"); btnNewButton.setFont(new Font("SimSun", Font.PLAIN, 20)); btnNewButton.setBounds(197, 266, 130, 42); btnNewButton.addActionListener(new Go()); ready.add(btnNewButton); Question_T = new JPanel(); content.add(Question_T, "Question_T"); Question_T.setLayout(null); textPane = new JTextPane(); textPane.setBounds(33, 13, 489, 225); Question_T.add(textPane); True = new JRadioButton("True"); True.setBounds(48, 278, 157, 27); True.addItemListener(new TFRadio()); Question_T.add(True); False = new JRadioButton("False"); False.setBounds(319, 278, 157, 27); False.addItemListener(new TFRadio()); Question_T.add(False); BG1 = new ButtonGroup(); BG1.add(True); BG1.add(False); BG2 = new ButtonGroup(); Question_M = new JPanel(); content.add(Question_M, "Question_M"); Question_M.setLayout(null); textPane_1 = new JTextPane(); textPane_1.setBounds(27, 13, 489, 225); Question_M.add(textPane_1); rdbtnNewRadioButton = new JRadioButton("A"); rdbtnNewRadioButton.setHorizontalAlignment(SwingConstants.CENTER); rdbtnNewRadioButton.setBounds(26, 257, 81, 27); rdbtnNewRadioButton.addItemListener(new TFRadio()); Question_M.add(rdbtnNewRadioButton); rdbtnB = new JRadioButton("B"); rdbtnB.setHorizontalAlignment(SwingConstants.CENTER); rdbtnB.setBounds(275, 257, 81, 27); rdbtnB.addItemListener(new TFRadio()); Question_M.add(rdbtnB); rdbtnC = new JRadioButton("C"); rdbtnC.setHorizontalAlignment(SwingConstants.CENTER); rdbtnC.setBounds(27, 289, 81, 27); rdbtnC.addItemListener(new TFRadio()); Question_M.add(rdbtnC); rdbtnD = new JRadioButton("D"); rdbtnD.setHorizontalAlignment(SwingConstants.CENTER); rdbtnD.setBounds(275, 289, 81, 27); rdbtnD.addItemListener(new TFRadio()); Question_M.add(rdbtnD); BG2.add(rdbtnNewRadioButton); BG2.add(rdbtnB); BG2.add(rdbtnC); BG2.add(rdbtnD); Submit = new JPanel(); content.add(Submit, "Submit"); Submit.setLayout(null); JLabel lblHaveYouFinished = new JLabel("Have you finished all the questions?"); lblHaveYouFinished.setHorizontalAlignment(SwingConstants.CENTER); lblHaveYouFinished.setFont(new Font("SimSun", Font.BOLD, 22)); lblHaveYouFinished.setBounds(14, 42, 508, 59); Submit.add(lblHaveYouFinished); JLabel lblOnceYouSubmitno = new JLabel("Once you submit,"); lblOnceYouSubmitno.setHorizontalAlignment(SwingConstants.CENTER); lblOnceYouSubmitno.setFont(new Font("SimSun", Font.BOLD, 22)); lblOnceYouSubmitno.setBounds(24, 111, 508, 59); Submit.add(lblOnceYouSubmitno); JLabel lblYouCantChange = new JLabel("there's no chance to change your answers."); lblYouCantChange.setHorizontalAlignment(SwingConstants.CENTER); lblYouCantChange.setFont(new Font("SimSun", Font.BOLD, 22)); lblYouCantChange.setBounds(0, 183, 532, 59); Submit.add(lblYouCantChange); JButton btnSubmit = new JButton("Submit"); btnSubmit.setFont(new Font("SimSun", Font.PLAIN, 24)); btnSubmit.setBounds(222, 291, 124, 42); btnSubmit.addActionListener(new Submit()); Submit.add(btnSubmit); Score = new JPanel(); content.add(Score, "Score"); Score.setLayout(null); JLabel lblNewLabel = new JLabel("Your final score is :"); lblNewLabel.setFont(new Font("SimSun", Font.BOLD, 30)); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel.setBounds(14, 106, 357, 69); Score.add(lblNewLabel); lblNewLabel_1 = new JLabel(" "); lblNewLabel_1.setFont(new Font("SimSun", Font.BOLD, 30)); lblNewLabel_1.setBounds(392, 106, 103, 69); Score.add(lblNewLabel_1); label = new JLabel(" "); label.setHorizontalAlignment(SwingConstants.CENTER); label.setFont(new Font("SimSun", Font.PLAIN, 24)); label.setText(" "); label.setBounds(164, 4, 83, 33); desktopPane.add(label); instructor = new JPanel(); contentPane.add(instructor, "instructor"); instructor.setLayout(null); JDesktopPane desktopPane_1 = new JDesktopPane(); desktopPane_1.setBounds(0, 0, 681, 417); instructor.add(desktopPane_1); desktopPane_1.setBackground(Color.WHITE); teacher = new JPanel(); teacher.setBounds(0, 80, 681, 337); desktopPane_1.add(teacher); teacher.setLayout(new CardLayout(0, 0)); Index = new JPanel(); teacher.add(Index, "Index"); Index.setLayout(null); lblNewLabel_2 = new JLabel("If you want to add a question,please click add button."); lblNewLabel_2.setFont(new Font("SimSun", Font.PLAIN, 21)); lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_2.setBounds(0, 23, 681, 83); Index.add(lblNewLabel_2); lblIfYouWant = new JLabel("If you want to select a question,please click select button."); lblIfYouWant.setHorizontalAlignment(SwingConstants.CENTER); lblIfYouWant.setFont(new Font("SimSun", Font.PLAIN, 21)); lblIfYouWant.setBounds(0, 102, 681, 83); Index.add(lblIfYouWant); Add = new JPanel(); teacher.add(Add, "Add"); Add.setLayout(null); qField = new JTextField(); qField.setBounds(186, 13, 481, 178); Add.add(qField); qField.setColumns(10); lblQuestion = new JLabel("Question:"); lblQuestion.setFont(new Font("SimSun", Font.PLAIN, 25)); lblQuestion.setHorizontalAlignment(SwingConstants.CENTER); lblQuestion.setBounds(14, 13, 158, 51); Add.add(lblQuestion); aField = new JTextField(); aField.setBounds(186, 207, 197, 72); Add.add(aField); aField.setColumns(10); lblAnswer = new JLabel("Answer:"); lblAnswer.setHorizontalAlignment(SwingConstants.CENTER); lblAnswer.setFont(new Font("SimSun", Font.PLAIN, 25)); lblAnswer.setBounds(14, 207, 158, 51); Add.add(lblAnswer); Insert = new JButton("Insert"); Insert.setBounds(484, 223, 143, 40); Insert.addActionListener(new QuestionAction()); Add.add(Insert); Select = new JPanel(); teacher.add(Select, "Select"); Select.setLayout(null); label_4 = new JLabel("UCID:"); label_4.setHorizontalAlignment(SwingConstants.CENTER); label_4.setFont(new Font("SimSun", Font.PLAIN, 24)); label_4.setBounds(0, 0, 153, 40); desktopPane_1.add(label_4); label_5 = new JLabel(" "); label_5.setHorizontalAlignment(SwingConstants.CENTER); label_5.setFont(new Font("SimSun", Font.PLAIN, 24)); label_5.setText(" "); label_5.setBounds(167, 0, 100, 40); desktopPane_1.add(label_5); addquestion = new JButton("Add question"); addquestion.setBounds(342, 4, 143, 40); addquestion.addActionListener(new Add()); desktopPane_1.add(addquestion); selquestion = new JButton("Select question"); selquestion.setBounds(499, 4, 168, 40); selquestion.addActionListener(new Select()); desktopPane_1.add(selquestion); }
private void initGUI() { try { this.setPreferredSize(new java.awt.Dimension(471, 531)); this.setBounds(0, 0, 642, 304); setVisible(true); this.setIconifiable(true); this.setClosable(true); { jDesktopPane1 = new JDesktopPane(); jDesktopPane1.setBackground(Color.WHITE); this.getContentPane().add(jDesktopPane1, BorderLayout.CENTER); jDesktopPane1.setPreferredSize(new java.awt.Dimension(462, 497)); jDesktopPane1.setLayout(null); jTextFieldSSCC = new JTextField4j(); AbstractDocument doc = (AbstractDocument) jTextFieldSSCC.getDocument(); doc.setDocumentFilter(new JFixedSizeFilter(JDBPallet.field_sscc)); jTextFieldSSCC.addKeyListener( new KeyAdapter() { @Override public void keyReleased(KeyEvent arg0) { refresh(); } }); jTextFieldSSCC.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { refresh(); } }); jDesktopPane1.add(jTextFieldSSCC); jTextFieldSSCC.setBounds(121, 24, 134, 21); jTextFieldNewSSCC = new JTextField4j(); jDesktopPane1.add(jTextFieldNewSSCC); jTextFieldNewSSCC.setEditable(false); jTextFieldNewSSCC.setEnabled(false); jTextFieldNewSSCC.setBounds(121, 53, 134, 21); jFormattedTextFieldQuantity = new JQuantityInput(new BigDecimal("0")); jDesktopPane1.add(jFormattedTextFieldQuantity); jFormattedTextFieldQuantity.setFont(Common.font_std); jFormattedTextFieldQuantity.setHorizontalAlignment(SwingConstants.TRAILING); jFormattedTextFieldQuantity.setBounds(464, 24, 91, 21); jFormattedTextFieldQuantity.setVerifyInputWhenFocusTarget(false); jFormattedTextFieldQuantity.setEnabled(false); jFormattedTextFieldNewQuantity = new JQuantityInput(new BigDecimal("0")); jDesktopPane1.add(jFormattedTextFieldNewQuantity); jFormattedTextFieldNewQuantity.setFont(Common.font_std); jFormattedTextFieldNewQuantity.setHorizontalAlignment(SwingConstants.TRAILING); jFormattedTextFieldNewQuantity.setBounds(464, 53, 91, 21); jFormattedTextFieldNewQuantity.setVerifyInputWhenFocusTarget(false); jFormattedTextFieldNewQuantity.setEnabled(false); jFormattedTextFieldSplitQuantity = new JQuantityInput(new BigDecimal("0")); jDesktopPane1.add(jFormattedTextFieldSplitQuantity); jFormattedTextFieldSplitQuantity.setFont(Common.font_std); jFormattedTextFieldSplitQuantity.setHorizontalAlignment(SwingConstants.TRAILING); jFormattedTextFieldSplitQuantity.setBounds(269, 87, 91, 21); jFormattedTextFieldSplitQuantity.setVerifyInputWhenFocusTarget(false); labelSSCCQuantity = new JLabel4j_std(); jDesktopPane1.add(labelSSCCQuantity); labelSSCCQuantity.setText(lang.get("lbl_Pallet_Quantity")); labelSSCCQuantity.setHorizontalAlignment(SwingConstants.TRAILING); labelSSCCQuantity.setBounds(369, 24, 88, 21); labelSSCCNewQuantity = new JLabel4j_std(); jDesktopPane1.add(labelSSCCNewQuantity); labelSSCCNewQuantity.setText(lang.get("lbl_Pallet_Quantity")); labelSSCCNewQuantity.setHorizontalAlignment(SwingConstants.TRAILING); labelSSCCNewQuantity.setBounds(369, 53, 88, 21); labelNewSSCCQuantity = new JLabel4j_std(); jDesktopPane1.add(labelNewSSCCQuantity); labelNewSSCCQuantity.setText(lang.get("lbl_Required_Quantity")); labelNewSSCCQuantity.setHorizontalAlignment(SwingConstants.TRAILING); labelNewSSCCQuantity.setBounds(137, 86, 125, 21); jButtonSplit = new JButton4j(Common.icon_split); jButtonSplit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String splitSSCC = pal.splitPallet( jTextFieldSSCC.getText(), new BigDecimal(jFormattedTextFieldSplitQuantity.getValue().toString())); if (splitSSCC.equals("") == false) { lblStatus.setText( "SSCC " + jTextFieldSSCC.getText() + " updated, SSCC " + splitSSCC + " created."); jTextFieldNewSSCC.setText(splitSSCC); jFormattedTextFieldNewQuantity.setValue( jFormattedTextFieldSplitQuantity.getValue()); String pq = comboBoxPrintQueue.getSelectedItem().toString(); if (checkBoxPrintOldSSCC.isSelected()) { buildSQL1Record(jTextFieldSSCC.getText()); JLaunchReport.runReport( "RPT_PALLET_LABEL", listStatement, jCheckBoxAutoPreview.isSelected(), pq, Integer.valueOf(jSpinnerCopies.getValue().toString()), checkBoxIncHeaderText.isSelected()); } if (checkBoxPrintNewSSCC.isSelected()) { buildSQL1Record(jTextFieldNewSSCC.getText()); JLaunchReport.runReport( "RPT_PALLET_LABEL", listStatement, jCheckBoxAutoPreview.isSelected(), pq, Integer.valueOf(jSpinnerCopies.getValue().toString()), checkBoxIncHeaderText.isSelected()); } } else { JUtility.errorBeep(); JOptionPane.showMessageDialog( Common.mainForm, pal.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.WARNING_MESSAGE); } } }); jDesktopPane1.add(jButtonSplit); jButtonSplit.setText(lang.get("btn_Split")); jButtonSplit.setMnemonic(lang.getMnemonicChar()); jButtonSplit.setBounds(151, 205, 111, 28); jButtonHelp = new JButton4j(Common.icon_help); jDesktopPane1.add(jButtonHelp); jButtonHelp.setText(lang.get("btn_Help")); jButtonHelp.setMnemonic(lang.getMnemonicChar()); jButtonHelp.setBounds(265, 205, 111, 28); jButtonCancel = new JButton4j(Common.icon_close); jDesktopPane1.add(jButtonCancel); jButtonCancel.setText(lang.get("btn_Close")); jButtonCancel.setMnemonic(lang.getMnemonicChar()); jButtonCancel.setBounds(378, 205, 111, 28); jButtonCancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { dispose(); } }); labelSSCC = new JLabel4j_std(); jDesktopPane1.add(labelSSCC); labelSSCC.setText(lang.get("lbl_Source_SSCC")); labelSSCC.setBounds(6, 24, 103, 21); labelSSCC.setHorizontalAlignment(SwingConstants.TRAILING); labelNewSSCC = new JLabel4j_std(); jDesktopPane1.add(labelNewSSCC); labelNewSSCC.setText(lang.get("lbl_Destination_SSCC")); labelNewSSCC.setBounds(18, 53, 91, 21); labelNewSSCC.setHorizontalAlignment(SwingConstants.TRAILING); JLabel4j_std labelHeader = new JLabel4j_std(); labelHeader.setHorizontalAlignment(SwingConstants.TRAILING); labelHeader.setText(lang.get("lbl_Label_Header_Text")); labelHeader.setBounds(18, 112, 91, 21); jDesktopPane1.add(labelHeader); checkBoxIncHeaderText.setText("New JCheckBox"); checkBoxIncHeaderText.setSelected(true); checkBoxIncHeaderText.setBackground(Color.WHITE); checkBoxIncHeaderText.setBounds(121, 112, 21, 21); jDesktopPane1.add(checkBoxIncHeaderText); JLabel4j_std labelQuantity = new JLabel4j_std(); labelQuantity.setBounds(248, 112, 182, 21); labelQuantity.setHorizontalAlignment(SwingConstants.RIGHT); labelQuantity.setText(lang.get("lbl_Number_of_SSCCs")); jDesktopPane1.add(labelQuantity); JLabel4j_std labelCopies = new JLabel4j_std(); labelCopies.setHorizontalAlignment(SwingConstants.RIGHT); labelCopies.setBounds(248, 141, 182, 21); labelCopies.setText(lang.get("lbl_Labels_Per_SSCC")); jDesktopPane1.add(labelCopies); jSpinnerQuantity.setEnabled(false); jSpinnerQuantity.setModel( new SpinnerNumberModel(new Integer(1), null, null, new Integer(1))); jSpinnerQuantity.setFont(Common.font_std); jSpinnerQuantity.setBounds(437, 112, 39, 21); JSpinner.NumberEditor ne = new JSpinner.NumberEditor(jSpinnerQuantity); ne.getTextField().setFont(Common.font_std); jSpinnerQuantity.setEditor(ne); jDesktopPane1.add(jSpinnerQuantity); jSpinnerCopies.setFont(Common.font_std); jSpinnerCopies.setBounds(437, 141, 39, 21); jSpinnerCopies.setInputVerifier(null); jSpinnerCopies.setModel(copiesnumbermodel); JSpinner.NumberEditor nec2 = new JSpinner.NumberEditor(jSpinnerCopies); nec2.getTextField().setFont(Common.font_std); jSpinnerCopies.setEditor(nec2); jDesktopPane1.add(jSpinnerCopies); JLabel4j_std label_3 = new JLabel4j_std(lang.get("lbl_Print_Queue")); label_3.setHorizontalAlignment(SwingConstants.TRAILING); label_3.setBounds(18, 174, 91, 21); jDesktopPane1.add(label_3); comboBoxPrintQueue.setSelectedIndex(-1); comboBoxPrintQueue.setBounds(121, 170, 471, 23); jDesktopPane1.add(comboBoxPrintQueue); jCheckBoxAutoPreview = new JCheckBox(); jCheckBoxAutoPreview.setToolTipText("Auto SSCC"); jCheckBoxAutoPreview.setText("New JCheckBox"); jCheckBoxAutoPreview.setSelected(true); jCheckBoxAutoPreview.setEnabled(false); jCheckBoxAutoPreview.setBackground(Color.WHITE); jCheckBoxAutoPreview.setBounds(121, 141, 21, 21); jCheckBoxAutoPreview.setEnabled( Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_PRODDEC_PREVIEW")); jDesktopPane1.add(jCheckBoxAutoPreview); labelPreview = new JLabel4j_std(); labelPreview.setBounds(18, 141, 91, 21); labelPreview.setHorizontalTextPosition(SwingConstants.CENTER); labelPreview.setHorizontalAlignment(SwingConstants.TRAILING); labelPreview.setText(lang.get("lbl_Preview")); jDesktopPane1.add(labelPreview); lblStatus.setForeground(Color.RED); lblStatus.setBackground(Color.GRAY); lblStatus.setBounds(2, 235, 610, 21); jDesktopPane1.add(lblStatus); JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); panel.setBorder( new TitledBorder( null, lang.get("btn_Print"), TitledBorder.CENTER, TitledBorder.TOP, null, null)); panel.setBounds(270, 6, 90, 75); jDesktopPane1.add(panel); panel.setLayout(null); checkBoxPrintOldSSCC.setSelected(true); checkBoxPrintOldSSCC.setBounds(32, 17, 28, 23); panel.add(checkBoxPrintOldSSCC); checkBoxPrintNewSSCC.setSelected(true); checkBoxPrintNewSSCC.setBounds(32, 46, 28, 23); panel.add(checkBoxPrintNewSSCC); mod.setModuleId("RPT_PALLET_LABEL"); mod.getModuleProperties(); if (mod.getReportType().equals("Label")) { jCheckBoxAutoPreview.setSelected(false); jCheckBoxAutoPreview.setEnabled(false); } else { jSpinnerCopies.setVisible(false); labelCopies.setVisible(false); } populatePrinterList(JPrint.getDefaultPrinterQueueName()); } } catch (Exception e) { e.printStackTrace(); } }
private void initGUI() { try { this.setPreferredSize(new java.awt.Dimension(538, 440)); this.setBounds(0, 0, 526 + Common.LFAdjustWidth, 459 + Common.LFAdjustHeight); setVisible(true); this.setClosable(true); this.setIconifiable(true); { jDesktopPane1 = new JDesktopPane(); jDesktopPane1.setBackground(Color.WHITE); this.getContentPane().add(jDesktopPane1, BorderLayout.NORTH); jDesktopPane1.setPreferredSize(new Dimension(536, 415)); { jScrollPaneAssigned = new JScrollPane(); jDesktopPane1.add(jScrollPaneAssigned); jScrollPaneAssigned.setBounds(10, 25, 220, 340); jScrollPaneAssigned.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); { ListModel jListAssignedModel = new DefaultComboBoxModel(new String[] {"Item One", "Item Two"}); jListAssigned = new JDBModuleJList(Common.selectedHostID, Common.sessionID); jScrollPaneAssigned.setViewportView(jListAssigned); jListAssigned.setBackground(Common.color_list_assigned); jListAssigned.setCellRenderer(Common.renderer_list_assigned); jListAssigned.setModel(jListAssignedModel); } } { jScrollPaneUnAssigned = new JScrollPane(); jDesktopPane1.add(jScrollPaneUnAssigned); jScrollPaneUnAssigned.setBounds(272, 25, 220, 340); jScrollPaneUnAssigned.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); { ListModel jListUnAssignedModel = new DefaultComboBoxModel(new String[] {"Item One", "Item Two"}); jListUnAssigned = new JDBModuleJList(Common.selectedHostID, Common.sessionID); jScrollPaneUnAssigned.setViewportView(jListUnAssigned); jListUnAssigned.setBackground(Common.color_list_unassigned); jListUnAssigned.setCellRenderer(Common.renderer_list_unassigned); jListUnAssigned.setModel(jListUnAssignedModel); } } { jButtonAssign = new JButton4j(Common.icon_arrow_left); jDesktopPane1.add(jButtonAssign); jButtonAssign.setBounds(238, 133, 25, 25); jButtonAssign.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { if (jListUnAssigned.getSelectedIndex() > -1) { for (int j = jListUnAssigned.getMaxSelectionIndex(); j >= jListUnAssigned.getMinSelectionIndex(); j--) { if (jListUnAssigned.isSelectedIndex(j)) { JDBListData item = (JDBListData) jListUnAssigned.getModel().getElementAt(j); addToList(assignedList, item, false); } } for (int j = jListUnAssigned.getMaxSelectionIndex(); j >= jListUnAssigned.getMinSelectionIndex(); j--) { if (jListUnAssigned.isSelectedIndex(j)) { Object item = jListUnAssigned.getModel().getElementAt(j); removeFromList(unassignedList, item); } } refreshJList(jListAssigned, assignedModel, assignedList); refreshJList(jListUnAssigned, unassignedModel, unassignedList); setButtonState(); } } }); } { jButtonUnAssign = new JButton4j(Common.icon_arrow_right); jDesktopPane1.add(jButtonUnAssign); jButtonUnAssign.setBounds(238, 168, 25, 25); jButtonUnAssign.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { if (jListAssigned.getSelectedIndex() > -1) { for (int j = jListAssigned.getMaxSelectionIndex(); j >= jListAssigned.getMinSelectionIndex(); j--) { if (jListAssigned.isSelectedIndex(j)) { JDBListData item = (JDBListData) jListAssigned.getModel().getElementAt(j); addToList(unassignedList, item, true); } } for (int j = jListAssigned.getMaxSelectionIndex(); j >= jListAssigned.getMinSelectionIndex(); j--) { if (jListAssigned.isSelectedIndex(j)) { Object item = jListAssigned.getModel().getElementAt(j); removeFromList(assignedList, item); } } refreshJList(jListUnAssigned, unassignedModel, unassignedList); refreshJList(jListAssigned, assignedModel, assignedList); setButtonState(); } } }); } { jButtonUp = new JButton4j(Common.icon_arrow_up); jDesktopPane1.add(jButtonUp); jButtonUp.setBounds(238, 100, 25, 25); jButtonUp.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { int sel = jListAssigned.getSelectedIndex(); JDBListData element = ((JDBListData) jListAssigned.getModel().getElementAt(sel)); assignedList = JDBModule.moveElementUp(assignedList, element); refreshJList(jListAssigned, assignedModel, assignedList); jListAssigned.setSelectedIndex(assignedList.indexOf(element)); jButtonSave.setEnabled(true); jButtonUndo.setEnabled(true); } }); } { jButtonDown = new JButton4j(Common.icon_arrow_down); jDesktopPane1.add(jButtonDown); jButtonDown.setBounds(238, 205, 25, 25); jButtonDown.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { int j = jListAssigned.getSelectedIndex(); JDBListData element = ((JDBListData) jListAssigned.getModel().getElementAt(j)); assignedList = JDBModule.moveElementDown(assignedList, element); refreshJList(jListAssigned, assignedModel, assignedList); jListAssigned.setSelectedIndex(assignedList.indexOf(element)); jButtonSave.setEnabled(true); jButtonUndo.setEnabled(true); } }); } { jButtonClose = new JButton4j(Common.icon_close); jDesktopPane1.add(jButtonClose); jButtonClose.setText(lang.get("btn_Close")); jButtonClose.setBounds(369, 373, 110, 30); jButtonClose.setMnemonic(lang.getMnemonicChar()); jButtonClose.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { dispose(); } }); } { jButtonHelp = new JButton4j(Common.icon_help); jDesktopPane1.add(jButtonHelp); jButtonHelp.setText(lang.get("btn_Help")); jButtonHelp.setBounds(258, 373, 110, 30); jButtonHelp.setMnemonic(lang.getMnemonicChar()); } { jButtonSave = new JButton4j(Common.icon_update); jDesktopPane1.add(jButtonSave); jButtonSave.setText(lang.get("btn_Save")); jButtonSave.setBounds(30, 373, 112, 30); jButtonSave.setEnabled(false); jButtonSave.setMnemonic(lang.getMnemonicChar()); jButtonSave.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { JDBRFMenu t = new JDBRFMenu(Common.selectedHostID, Common.sessionID); t.rewriteRFMenu(assignedList); jButtonSave.setEnabled(false); jButtonUndo.setEnabled(false); } }); } { jButtonUndo = new JButton4j(Common.icon_undo); jDesktopPane1.add(jButtonUndo); jButtonUndo.setText(lang.get("btn_Undo")); jButtonUndo.setBounds(145, 373, 112, 30); jButtonUndo.setEnabled(false); jButtonUndo.setMnemonic(lang.getMnemonicChar()); jButtonUndo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { populateAssignedList(); populateUnAssignedList(); jButtonSave.setEnabled(false); jButtonUndo.setEnabled(false); } }); } { jLabel1 = new JLabel4j_title(); jDesktopPane1.add(jLabel1); jLabel1.setText(lang.get("lbl_Assigned")); jLabel1.setBounds(10, 5, 208, 18); jLabel1.setFont(Common.font_title); } { jLabel2 = new JLabel4j_title(); jDesktopPane1.add(jLabel2); jLabel2.setText(lang.get("lbl_Unassigned")); jLabel2.setBounds(272, 4, 154, 18); jLabel2.setFont(Common.font_title); } } } catch (Exception e) { e.printStackTrace(); } }