/** Show the filter dialog */ public void showDialog() { empty_border = new EmptyBorder(5, 5, 0, 5); indent_border = new EmptyBorder(5, 25, 5, 5); include_panel = new ServiceFilterPanel("Include messages based on target service:", filter_include_list); exclude_panel = new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list); status_box = new JCheckBox("Filter messages based on status:"); status_box.addActionListener(this); status_active = new JRadioButton("Active messages only"); status_active.setSelected(true); status_active.setEnabled(false); status_complete = new JRadioButton("Complete messages only"); status_complete.setEnabled(false); status_group = new ButtonGroup(); status_group.add(status_active); status_group.add(status_complete); if (filter_active || filter_complete) { status_box.setSelected(true); status_active.setEnabled(true); status_complete.setEnabled(true); if (filter_complete) { status_complete.setSelected(true); } } status_options = new JPanel(); status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS)); status_options.add(status_active); status_options.add(status_complete); status_options.setBorder(indent_border); status_panel = new JPanel(); status_panel.setLayout(new BorderLayout()); status_panel.add(status_box, BorderLayout.NORTH); status_panel.add(status_options, BorderLayout.CENTER); status_panel.setBorder(empty_border); ok_button = new JButton("Ok"); ok_button.addActionListener(this); cancel_button = new JButton("Cancel"); cancel_button.addActionListener(this); buttons = new JPanel(); buttons.setLayout(new FlowLayout()); buttons.add(ok_button); buttons.add(cancel_button); panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(include_panel); panel.add(exclude_panel); panel.add(status_panel); panel.add(buttons); dialog = new JDialog(); dialog.setTitle("SOAP Monitor Filter"); dialog.setContentPane(panel); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setModal(true); dialog.pack(); Dimension d = dialog.getToolkit().getScreenSize(); dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2); ok_pressed = false; dialog.show(); }
public void createDialogBox(String Roll, String ExamYear) { RPS = new JDialog(); this.NumberOfCourses = DataTransfer.Courses.size(); this.Roll = Roll; this.ExamYear = ExamYear; this.Session = setSession(); final int Final = NumberOfCourses; final int Height = (Final * 40 + 270 > 600) ? Final * 40 + 270 : 600; Panel = new JPanel() { protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage( new ImageIcon(getClass().getResource("/Icons/8.jpg")).getImage(), 0, 0, 950, Height, null); ButtonBorder.paintBorder(this, g, 284, 84 + Final * 40 + 60 + 60, 252, 32); } }; Panel.setPreferredSize( new Dimension( 600, NumberOfCourses * 40 + 150 + 60 + 60)); // 50+(100*5+3*5)+50, 120+NumberOfCourses*30+(NumberOfCourses-1)*10+50+60 Panel.setLayout(null); RollLabel = new JLabel("Roll : " + this.Roll, SwingConstants.CENTER); RollLabel.setForeground(Color.WHITE); RollLabel.setFont(new Font("SERRIF", Font.BOLD, 15)); RollLabel.setBounds(112, 20, 615, 20); Panel.add(RollLabel); SessionLabel = new JLabel("Session : " + this.Session, SwingConstants.CENTER); SessionLabel.setForeground(Color.WHITE); SessionLabel.setFont(new Font("SERRIF", Font.BOLD, 15)); SessionLabel.setBounds(112, 40, 615, 20); Panel.add(SessionLabel); ColumnName = new JLabel("", SwingConstants.LEFT); ColumnName.setText( " COURSE NO. TOTAL MARKS GRADE POINT LETTER GRADE COURSE CREDIT EXAM-TYPE"); ColumnName.setForeground(Color.WHITE); ColumnName.setFont(new Font("SERRIF", Font.BOLD, 10)); ColumnName.setBounds(112, 80, 635, 30); Panel.add(ColumnName); TakenLabel1 = new JLabel("Credit Hour Taken : ", SwingConstants.RIGHT); TakenLabel1.setForeground(Color.WHITE); TakenLabel1.setFont(new Font("SERRIF", Font.ITALIC, 12)); TakenLabel1.setBounds(112, 85 + NumberOfCourses * 40 + 60, 130, 20); Panel.add(TakenLabel1); TakenLabel2 = new JLabel("", SwingConstants.LEFT); TakenLabel2.setForeground(Color.WHITE); TakenLabel2.setFont(new Font("SERRIF", Font.ITALIC, 12)); TakenLabel2.setBounds(242, 85 + NumberOfCourses * 40 + 60, 50, 20); Panel.add(TakenLabel2); CompletedLabel1 = new JLabel("Credit Hour Completed : ", SwingConstants.RIGHT); CompletedLabel1.setForeground(Color.WHITE); CompletedLabel1.setFont( new Font("SERRIF", Font.ITALIC, 12)); // 50,85+NumberOfCourses*40+60+20,150,20 CompletedLabel1.setBounds(342, 85 + NumberOfCourses * 40 + 60, 150, 20); Panel.add(CompletedLabel1); CompletedLabel2 = new JLabel("opps", SwingConstants.LEFT); CompletedLabel2.setForeground(Color.WHITE); CompletedLabel2.setFont(new Font("SERRIF", Font.ITALIC, 12)); CompletedLabel2.setBounds(492, 85 + NumberOfCourses * 40 + 60, 50, 20); Panel.add(CompletedLabel2); GPALabel1 = new JLabel("GPA : ", SwingConstants.RIGHT); GPALabel1.setForeground(Color.WHITE); GPALabel1.setFont(new Font("SERRIF", Font.ITALIC, 12)); GPALabel1.setBounds(552, 85 + NumberOfCourses * 40 + 60, 80, 20); Panel.add(GPALabel1); GPALabel2 = new JLabel("36.25", SwingConstants.LEFT); GPALabel2.setForeground(Color.WHITE); GPALabel2.setFont(new Font("SERRIF", Font.ITALIC, 12)); GPALabel2.setBounds(632, 85 + NumberOfCourses * 40 + 60, 50, 20); Panel.add(GPALabel2); DocButton = new JButton("Create Document"); DocButton.setFont(new Font("SERRIF", Font.BOLD, 15)); DocButton.setBounds( 285, 85 + NumberOfCourses * 40 + 60 + 60, 250, 30); // 50+NumberOfCourses*30+(NumberOfCourses-1)*10+35 DocButton.addActionListener(this); Panel.add(DocButton); CheckAll = new JCheckBox("Uncheck all"); CheckAll.setForeground(Color.WHITE); CheckAll.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 12)); CheckAll.setOpaque(false); CheckAll.setSelected(true); CheckAll.addActionListener(this); setComponentsOnTheGrid(); Scroll = new JScrollPane( Panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); RPS.add(Scroll); RPS.setModal(true); RPS.setTitle(" Result : Particular Student "); RPS.setResizable(false); RPS.setSize(840, 565); RPS.setLocation( 250, 100 + (565 - RPS.getHeight()) / 2); // setiing RPS dialogbox in the middle of MenuFrame RPS.setVisible(true); }