AdminMain() { l = new JLabel(); l.setBounds(10, 20, 1340, 1000); l.setBackground(Color.black); Font ft = new Font("Arial", Font.BOLD, 30); Font ft1 = new Font("Arial", Font.BOLD, 14); Font ft2 = new Font("Arial", Font.BOLD, 20); f1 = new Frame("Soft Test Management (Beta)"); f1.setLayout(null); l1 = new Label("Test Instructions", l1.CENTER); l1.setBounds(10, 20, 1300, 60); l1.setForeground(Color.blue); l1.setBackground(Color.white); l1.setFont(ft); l2 = new JLabel("Deletion of Faculty/Students"); l2.setBounds(20, 30, 1000, 500); l2.setBackground(Color.blue); l2.setFont(ft2); l3 = new JLabel("Test Pattern"); l3.setBounds(20, 90, 1300, 500); l3.setBackground(Color.green); l3.setFont(ft2); b1 = new JButton("Go !"); b1.setBounds(300, 220, 120, 30); b1.setBackground(Color.white); b1.setForeground(Color.blue); b1.setFont(ft2); b2 = new JButton("Go"); b2.setBounds(300, 240, 120, 30); b2.setBackground(Color.white); b2.setForeground(Color.blue); b2.setFont(ft2); f1.add(l); l.add(l1); l2.add(b1); l.add(l2); l3.add(b2); l.add(l3); b1.addActionListener(this); b2.addActionListener(this); f1.setVisible(true); f1.setSize(1800, 800); }
private JButton createCopyToClipboardButton() { JButton button = new JButton("COPY TO CLIPBOARD"); button.setBackground(Color.BLACK); button.setForeground(Color.GRAY); button.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { copyOverviewToClipboard(); } catch (InsufficientDataException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog( ReviewDialog.this, "Failed to copy the overview to clipboard: " + ex.getMessage()); } } }); return button; }
/** * The function creates a button, which opens a file chooser and writes a summary of the displayed * results into a user-selected file. * * @return The 'save to file' button. */ private JButton createSaveToFileButton() { JButton b = new JButton("SAVE TO FILE"); b.setBackground(Color.BLACK); b.setForeground(Color.GRAY); b.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { checkTotal(); fileChooser.setSelectedFile(new File(getDefaultFilename())); int returnValue = fileChooser.showDialog(ReviewDialog.this, "Save"); if (returnValue != JFileChooser.APPROVE_OPTION) return; writeToFile(fileChooser.getSelectedFile()); ReviewDialog.this.setVisible(false); } catch (Exception ex) { JOptionPane.showMessageDialog( ReviewDialog.this, ex.getMessage(), "Error occurred", JOptionPane.ERROR_MESSAGE); } } }); return b; }
public LogDateChooser(String label) { thisDialog = this; border = new EtchedBorder(); setBorder(border); Font f = new Font("Helvetica", Font.PLAIN, 10); title = new JLabel(label); add(title); setLayout(new DateLayout()); dfs = new DateFormatSymbols(); months = dfs.getMonths(); weekdays = dfs.getShortWeekdays(); for (int i = 0; i < 7; i++) { days[i] = new JLabel(weekdays[i + 1]); days[i].setFont(f); add(days[i]); } gc = new GregorianCalendar(); mDown = new JButton("<"); mDown.setMargin(new Insets(0, 0, 0, 0)); mDown.addActionListener(new MDownEar()); mDown.setBorderPainted(false); mDown.setFont(f); mDown.setForeground(Color.BLUE); add(mDown); mUp = new JButton(">"); mUp.setMargin(new Insets(0, 0, 0, 0)); mUp.addActionListener(new MUpEar()); mUp.setBorderPainted(false); mUp.setFont(f); mUp.setForeground(Color.BLUE); add(mUp); month = new JLabel(months[gc.get(Calendar.MONTH)]); month.setHorizontalAlignment(SwingConstants.CENTER); month.setFont(f); add(month); year = new JLabel(new Integer(gc.get(Calendar.YEAR)).toString()); year.setFont(f); add(year); yDown = new JButton("<"); yDown.setMargin(new Insets(0, 0, 0, 0)); yDown.addActionListener(new YDownEar()); yDown.setBorderPainted(false); yDown.setFont(f); yDown.setForeground(Color.BLUE); add(yDown); yUp = new JButton(">"); yUp.setMargin(new Insets(0, 0, 0, 0)); yUp.addActionListener(new YUpEar()); yUp.setBorderPainted(false); yUp.setFont(f); yUp.setForeground(Color.BLUE); add(yUp); // System.out.println(year.getText()); NumberEar numberEar = new NumberEar(); for (int i = 0; i < 31; i++) { number[i] = new JButton(new Integer(i + 1).toString()); number[i].setMargin(new Insets(0, 0, 0, 0)); number[i].addActionListener(numberEar); number[i].setBorderPainted(false); number[i].setContentAreaFilled(false); number[i].setFont(f); number[i].setForeground(Color.BLUE); add(number[i]); } number[0].setForeground(Color.CYAN); }