public void createGUI() { setLayout(new BorderLayout()); toolBar = new JToolBar("options", JToolBar.HORIZONTAL); toolBar.setFloatable(false); toolBar.setOpaque(true); toolBar.setBackground(new Color(154, 12, 12)); toolBar.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 15)); selectAllCB = new JCheckBox("Select All"); selectAllCB.setVisible(false); selectAllCB.setForeground(Color.white); selectAllCB.addActionListener(this); refreshBut = new JButton(new ImageIcon(this.getClass().getResource("/images/reloadIcon.png"))); refreshBut.setVisible(false); refreshBut.setToolTipText("Refresh"); refreshBut.setForeground(new Color(20, 88, 49)); refreshBut.addActionListener(this); backBut = new JButton(new ImageIcon(this.getClass().getResource("/images/backIcon.png"))); backBut.setVisible(false); backBut.setToolTipText("Back"); backBut.setForeground(new Color(20, 88, 49)); backBut.addActionListener(this); deleteBut = new JButton(new ImageIcon(this.getClass().getResource("/images/trashIcon.png"))); deleteBut.setToolTipText("Delete"); deleteBut.setForeground(Color.red); deleteBut.setVisible(false); deleteBut.addActionListener(this); deleteBut.setBackground(Color.red); restoreBut = new JButton(new ImageIcon(this.getClass().getResource("/images/restoreIcon.png"))); restoreBut.setToolTipText("Restore"); restoreBut.setForeground(Color.blue); restoreBut.setVisible(false); restoreBut.addActionListener(this); toolBar.addSeparator(new Dimension(10, 5)); toolBar.add(selectAllCB); toolBar.add(backBut); toolBar.add(refreshBut); toolBar.add(deleteBut); toolBar.add(restoreBut); add(toolBar, "North"); JPanel centPan = new JPanel(new GridBagLayout()); centPan.setBackground(new Color(52, 86, 70)); JLabel label = new JLabel("Select A Category From Left Pane"); label.setFont(new Font("arial", Font.BOLD, 35)); label.setForeground(Color.yellow); centPan.add(label); contentPan = new JScrollPane(centPan); contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); add(contentPan, "Center"); contentPan.repaint(); db = new Database(); // inboxSet = db.getData("SELECT * FROM messages WHERE tag='inbox' ORDER BY msg_id // desc"); // sentmailSet = db.getData("SELECT * FROM messages WHERE tag='sentmail' ORDER BY msg_id // desc"); // draftSet = db.getData("SELECT * FROM messages WHERE tag='draft' ORDER BY msg_id // desc"); // outboxSet = db.getData("SELECT * FROM messages WHERE tag='outbox' ORDER BY msg_id // desc"); // trashSet = db.getData("SELECT * FROM messages,trash WHERE messages.tag='trash' and // messages.msg_id=trash.msg_id ORDER BY deleted_at desc"); }
public void createGUI() { setLayout(new BorderLayout()); JPanel topPan = new JPanel(new BorderLayout()); // topPan.setBorder(BorderFactory.createRaisedSoftBevelBorder()); JPanel topCentPan = new JPanel(); JLabel titleLab = new JLabel(); titleLab.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15)); topCentPan.add(titleLab); JPanel topRightPan = new JPanel(); // Cursor handCursor = new Cursor(Cursor.HAND_CURSOR); replyBut = new JButton(new ImageIcon("src\\images\\replyIcon.png")); replyBut.setBorder(BorderFactory.createEmptyBorder()); replyBut.addActionListener(this); replyBut.setCursor(new Cursor(Cursor.HAND_CURSOR)); replyBut.setToolTipText("Reply"); replyBut.setContentAreaFilled(false); replyBut.setRolloverEnabled(true); forwardBut = new JButton(new ImageIcon("src\\images\\forwardIcon.png")); forwardBut.setBorder(BorderFactory.createEmptyBorder()); forwardBut.addActionListener(this); forwardBut.setCursor(new Cursor(Cursor.HAND_CURSOR)); forwardBut.setToolTipText("Forward"); forwardBut.setContentAreaFilled(false); forwardBut.setRolloverEnabled(true); topRightPan.add(replyBut); topRightPan.add(forwardBut); topPan.add(topCentPan, "Center"); topPan.add(topRightPan, "East"); JPanel centPan = new JPanel(new BorderLayout()); JPanel centTopPan = new JPanel(new BorderLayout()); JPanel centTopLeftPan = new JPanel(); JLabel fromLab = new JLabel(); fromLab.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 12)); JTextArea contentTA = new JTextArea(); // JEditorPane contentTA = new JEditorPane(JEditorPane.W3C_LENGTH_UNITS,""); contentTA.setLineWrap(true); contentTA.setEditable(false); centTopLeftPan.add(fromLab); JPanel centTopRightPan = new JPanel(); JLabel dateLab = new JLabel(); dateLab.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); centTopRightPan.add(dateLab); centTopPan.add(centTopLeftPan, "West"); centTopPan.add(centTopRightPan, "East"); centPan.add(centTopPan, "North"); centPan.add(new JScrollPane(contentTA), "Center"); add(topPan, "North"); add(centPan, "Center"); try { workingSet.absolute(pointer + 1); msgID = Home.bodyPan.msgID[pointer]; titleLab.setText(workingSet.getString("subject")); fromLab.setText("From: " + workingSet.getString("mail_addresses")); dateLab.setText(workingSet.getString("sent_date")); contentTA.setText(workingSet.getString("content")); } catch (SQLException sqlExc) { JOptionPane.showMessageDialog(this, sqlExc, "EXCEPTION", JOptionPane.ERROR_MESSAGE); } Home.bodyPan.remove(Home.bodyPan.contentPan); Home.bodyPan.contentPan = new JScrollPane(this); Home.bodyPan.add(Home.bodyPan.contentPan); Home.home.homeFrame.setVisible(true); }