public MyJObject(int i) { CourseCheckBox = new JCheckBox(DataTransfer.Courses.elementAt(i)); CourseCheckBox.setForeground(Color.WHITE); CourseCheckBox.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 13)); CourseCheckBox.setHorizontalAlignment(SwingConstants.LEFT); CourseCheckBox.setOpaque(false); CourseCheckBox.setSelected(true); TotalMarks = new JLabel( Float.toString( Float.valueOf( TwoDecimal.format(Float.parseFloat(DataTransfer.Total.elementAt(i))))), SwingConstants.CENTER); TotalMarks.setForeground(Color.WHITE); TotalMarks.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 13)); GradePoint = new JLabel(DataTransfer.GradePoint.elementAt(i), SwingConstants.LEFT); GradePoint.setForeground(Color.WHITE); GradePoint.setFont(new Font("SERRIF", Font.ITALIC, 13)); LetterGrade = new JLabel(DataTransfer.LetterGrade.elementAt(i), SwingConstants.LEFT); LetterGrade.setForeground(Color.WHITE); LetterGrade.setFont(new Font("SERRIF", Font.PLAIN, 13)); CreditLabel = new JLabel(Credit.elementAt(i), SwingConstants.LEFT); CreditLabel.setForeground(Color.WHITE); CreditLabel.setFont(new Font("SERRIF", Font.PLAIN, 13)); ExamTypeLabel = new JLabel(DataTransfer.ExamType.elementAt(i), SwingConstants.LEFT); ExamTypeLabel.setForeground(Color.WHITE); ExamTypeLabel.setFont(new Font("SERRIF", Font.PLAIN, 12)); }
@Override public Component getTreeCellRendererComponent( JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { invalidate(); final VirtualFile file = getFile(value); final DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; if (file == null) { if (value instanceof DefaultMutableTreeNode) { final Object uo = node.getUserObject(); if (uo instanceof String) { myColoredRenderer.getTreeCellRendererComponent( tree, value, selected, expanded, leaf, row, hasFocus); return myColoredRenderer; } } return myEmpty; } myCheckbox.setVisible(true); final TreeNodeState state = mySelectionManager.getState(node); myCheckbox.setEnabled( TreeNodeState.CLEAR.equals(state) || TreeNodeState.SELECTED.equals(state)); myCheckbox.setSelected(!TreeNodeState.CLEAR.equals(state)); myCheckbox.setOpaque(false); myCheckbox.setBackground(null); setBackground(null); myTextRenderer.getListCellRendererComponent(myFictive, file, 0, selected, hasFocus); revalidate(); return this; }
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JComponent c = (JComponent) render.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); c.setBorder(null); JCheckBox lab = new JCheckBox(); ListElement le = (ListElement) value; // if("r1-print".equals(le.getCategory())) // // lab.setIcon(ResourceManager.getIcon(com.kingdee.bos.ctrl.report.forapp.kdnote.client.ui.NoteFileDialogEx.class, "res.r1_print.gif")); // else // // lab.setIcon(ResourceManager.getIcon(com.kingdee.bos.ctrl.report.forapp.kdnote.client.ui.NoteFileDialogEx.class, "res/empty.gif")); lab.setSelected(le.isSelected()); lab.setOpaque(true); lab.setBackground(c.getBackground()); TableLayout tl = TableLayout.splitCol(2); tl.colStyle(0).setWidth(22); tl.colStyle(1).setPriX(1); KDPanel pan = new KDPanel(tl); pan.add(lab, tl.cell(0)); pan.add(c, tl.cell(1)); return pan; }
public void buildNorth() { title.setFont(titleFont); list.add(0, "Select Planet"); list.add(1, "Mercury"); list.add(2, "Venus"); list.add(3, "Earth"); list.add(4, "Mars"); list.add(5, "Asteroids"); list.add(6, "Jupiter"); list.add(7, "Saturn"); list.add(8, "Uranus"); list.add(9, "Neptune"); list.add(10, "Pluto"); ImageIcon fig = new ImageIcon(getImage(getCodeBase(), "Images/ss.jpg")); display = new JLabel(fig); factChoice.addItem("Select Fact"); factChoice.addItem("Volume"); factChoice.addItem("Surface Area"); factChoice.addItem("Density"); factChoice.addItem("Temperature"); factChoice.addItem("Distance From Earth"); factChoice.addItem("Diameter"); pNorth1.setOpaque(false); pNorth2.setOpaque(false); pNorth3.setOpaque(false); pNorth4.setOpaque(false); pNorth5.setOpaque(false); moons.setOpaque(false); whatUnits.setOpaque(false); add("North", pNorth1); pNorth1.add(pNorth2); pNorth2.add(planets); pNorth1.add(display); pNorth1.add(pNorth3); pNorth3.add("North", factChoice); pNorth3.add("Center", pNorth4); pNorth4.add(moons); pNorth4.add(whatUnits); pNorth3.add("South", pNorth5); pNorth5.add(fact); pNorth5.add(units); pNorth5.add(select); pNorth5.add(clear); }
private void createUI() { ShowMaxAction showMaxAction = new ShowMaxAction(); showMaxCheckBox = new JCheckBox(showMaxAction); showMaxCheckBox.setOpaque(false); showMaxCheckBox.setSelected(true); saveFileChooser = new JFileChooser(); saveFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); FileFilter pngFileFilter = new PngFileFilter(); saveFileChooser.setFileFilter(pngFileFilter); graphImageFactories = new GraphImageProducer[] { new TwentyMinutesProducer(mainFrame), new TwoHoursProducer(mainFrame), new TenHoursProducer(mainFrame), new OneDayProducer(mainFrame), new SevenDaysProducer(mainFrame), new ThirtyDaysProducer(mainFrame), new NinetyDaysProducer(mainFrame), new OneYearProducer(mainFrame), }; JPanel graphPanel = new JPanel(new GridLayout(1, 1)); graphLabel = new JLabel(); graphPanel.add(graphLabel); setLayout(new BorderLayout()); add(graphPanel, BorderLayout.CENTER); timerangeComboBox = new JComboBox( new Object[] { "20 minutes", "2 hours", "10 hours", "1 day", "7 days", "30 days", "90 days", "1 year", }); timerangeComboBox.addActionListener(new TimerangeActionListener()); sourcesComboBox = new JComboBox(); sourcesComboBox.addActionListener(new SourcesActionListener()); JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); toolbar.add(new JLabel("Source: ")); toolbar.add(sourcesComboBox); toolbar.addSeparator(); toolbar.add(new JLabel("Timerange: ")); toolbar.add(timerangeComboBox); toolbar.add(showMaxCheckBox); toolbar.addSeparator(); toolbar.add(new JButton(new SaveAction())); add(toolbar, BorderLayout.NORTH); setSelectedGraph(0); }
@Override public Component getTableCellEditorComponent( final JTable table, final Object value, final boolean isSelected, final int row, final int column) { JCheckBox checkBox = tune(value, isSelected, row, table, false); checkBox.setOpaque(true); return checkBox; }
public JComponent getController(final TresCanvas canvas) { JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 1, 0)); Color color = m_algo.getColor(); panel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, color)); panel.setBackground(color); JCheckBox checkBox = new JCheckBox(m_algo.m_name, m_doPaint) { @Override protected void fireItemStateChanged(ItemEvent event) { super.fireItemStateChanged(event); m_doPaint = (event.getStateChange() == ItemEvent.SELECTED); canvas.repaint(); } }; checkBox.setOpaque(false); panel.add(checkBox); panel.add(m_algo.getController(canvas)); return panel; }
/** * Creates an instance of <tt>ShowPreviewDialog</tt> * * @param chatPanel The <tt>ChatConversationPanel</tt> that is associated with this dialog. */ ShowPreviewDialog(final ChatConversationPanel chatPanel) { this.chatPanel = chatPanel; this.setTitle( GuiActivator.getResources().getI18NString("service.gui.SHOW_PREVIEW_DIALOG_TITLE")); okButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.OK")); cancelButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.CANCEL")); JPanel mainPanel = new TransparentPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // mainPanel.setPreferredSize(new Dimension(200, 150)); this.getContentPane().add(mainPanel); JTextPane descriptionMsg = new JTextPane(); descriptionMsg.setEditable(false); descriptionMsg.setOpaque(false); descriptionMsg.setText( GuiActivator.getResources().getI18NString("service.gui.SHOW_PREVIEW_WARNING_DESCRIPTION")); Icon warningIcon = null; try { warningIcon = new ImageIcon( ImageIO.read( GuiActivator.getResources().getImageURL("service.gui.icons.WARNING_ICON"))); } catch (IOException e) { logger.debug("failed to load the warning icon"); } JLabel warningSign = new JLabel(warningIcon); JPanel warningPanel = new TransparentPanel(); warningPanel.setLayout(new BoxLayout(warningPanel, BoxLayout.X_AXIS)); warningPanel.add(warningSign); warningPanel.add(Box.createHorizontalStrut(10)); warningPanel.add(descriptionMsg); enableReplacement = new JCheckBox( GuiActivator.getResources() .getI18NString("plugin.chatconfig.replacement.ENABLE_REPLACEMENT_STATUS")); enableReplacement.setOpaque(false); enableReplacement.setSelected(cfg.getBoolean(ReplacementProperty.REPLACEMENT_ENABLE, true)); enableReplacementProposal = new JCheckBox( GuiActivator.getResources() .getI18NString("plugin.chatconfig.replacement.ENABLE_REPLACEMENT_PROPOSAL")); enableReplacementProposal.setOpaque(false); JPanel checkBoxPanel = new TransparentPanel(); checkBoxPanel.setLayout(new BoxLayout(checkBoxPanel, BoxLayout.Y_AXIS)); checkBoxPanel.add(enableReplacement); checkBoxPanel.add(enableReplacementProposal); JPanel buttonsPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER)); buttonsPanel.add(okButton); buttonsPanel.add(cancelButton); mainPanel.add(warningPanel); mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(checkBoxPanel); mainPanel.add(buttonsPanel); okButton.addActionListener(this); cancelButton.addActionListener(this); this.setPreferredSize(new Dimension(390, 230)); }
/** Creates the GUI. */ public void majorLayout() { // // Setup Menu // JMenuBar menuBar = new JMenuBar(); JMenu file = new JMenu(ResourceHandler.getMessage("menu.file")); file.setMnemonic(ResourceHandler.getAcceleratorKey("menu.file")); file.add(exitMenuItem = new JMenuItem(ResourceHandler.getMessage("menu.exit"))); exitMenuItem.setMnemonic(ResourceHandler.getAcceleratorKey("menu.exit")); exitMenuItem.addActionListener(this); menuBar.add(file); JMenu edit = new JMenu(ResourceHandler.getMessage("menu.edit")); edit.setMnemonic(ResourceHandler.getAcceleratorKey("menu.edit")); edit.add(optionMenuItem = new JMenuItem(ResourceHandler.getMessage("menu.option"))); optionMenuItem.setMnemonic(ResourceHandler.getAcceleratorKey("menu.option")); optionMenuItem.addActionListener(this); menuBar.add(edit); JMenu help = new JMenu(ResourceHandler.getMessage("menu.help")); help.setMnemonic(ResourceHandler.getAcceleratorKey("menu.help")); help.add(helpMenuItem = new JMenuItem(ResourceHandler.getMessage("menu.help"))); helpMenuItem.setMnemonic(ResourceHandler.getAcceleratorKey("menu.help")); help.add(new JSeparator()); help.add(aboutMenuItem = new JMenuItem(ResourceHandler.getMessage("menu.about"))); aboutMenuItem.setMnemonic(ResourceHandler.getAcceleratorKey("menu.about")); helpMenuItem.addActionListener(this); aboutMenuItem.addActionListener(this); menuBar.add(help); setJMenuBar(menuBar); // // Setup main GUI // dirLabel = new JLabel(ResourceHandler.getMessage("converter_gui.lablel0")); dirTF = new JTextField(); dirBttn = new JButton(ResourceHandler.getMessage("button.browse.dir")); dirBttn.setMnemonic(ResourceHandler.getAcceleratorKey("button.browse.dir")); matchingLabel = new JLabel(ResourceHandler.getMessage("converter_gui.lablel1")); matchingTF = new JTextField(ResourceHandler.getMessage("converter_gui.lablel2")); recursiveCheckBox = new JCheckBox(ResourceHandler.getMessage("converter_gui.lablel3")); recursiveCheckBox.setMnemonic(ResourceHandler.getAcceleratorKey("converter_gui.lablel3")); backupLabel = new JLabel(ResourceHandler.getMessage("converter_gui.lablel5")); backupTF = new JTextField(); backupBttn = new JButton(ResourceHandler.getMessage("button.browse.backup")); backupBttn.setMnemonic(ResourceHandler.getAcceleratorKey("button.browse.backup")); templateLabel = new JLabel(ResourceHandler.getMessage("converter_gui.lablel7")); templateCh = new TemplateFileChoice(); staticVersioningLabel = new JLabel(ResourceHandler.getMessage("static.versioning.label")); String version = System.getProperty("java.version"); if (version.indexOf("-") > 0) { version = version.substring(0, version.indexOf("-")); } int dotIndex = version.indexOf("."); dotIndex = version.indexOf(".", dotIndex + 1); String familyVersion = version.substring(0, dotIndex); MessageFormat formatter = new MessageFormat(ResourceHandler.getMessage("static.versioning.radio.button")); staticVersioningRadioButton = new JRadioButton(formatter.format(new Object[] {version})); staticVersioningRadioButton.setMnemonic( ResourceHandler.getAcceleratorKey("static.versioning.radio.button")); formatter = new MessageFormat(ResourceHandler.getMessage("dynamic.versioning.radio.button")); dynamicVersioningRadioButton = new JRadioButton(formatter.format(new Object[] {familyVersion})); dynamicVersioningRadioButton.setMnemonic( ResourceHandler.getAcceleratorKey("dynamic.versioning.radio.button")); staticVersioningTextArea = new JTextArea(ResourceHandler.getMessage("static.versioning.text")); formatter = new MessageFormat(ResourceHandler.getMessage("dynamic.versioning.text")); dynamicVersioningTextArea = new JTextArea(formatter.format(new Object[] {familyVersion})); ButtonGroup versioningButtonGroup = new ButtonGroup(); versioningButtonGroup.add(staticVersioningRadioButton); versioningButtonGroup.add(dynamicVersioningRadioButton); runBttn = new JButton(ResourceHandler.getMessage("button.convert")); runBttn.setMnemonic(ResourceHandler.getAcceleratorKey("button.convert")); recursiveCheckBox.setOpaque(false); staticVersioningRadioButton.setOpaque(false); dynamicVersioningRadioButton.setOpaque(false); staticVersioningTextArea.setEditable(false); staticVersioningTextArea.setLineWrap(true); staticVersioningTextArea.setWrapStyleWord(true); dynamicVersioningTextArea.setEditable(false); dynamicVersioningTextArea.setLineWrap(true); dynamicVersioningTextArea.setWrapStyleWord(true); staticVersioningPanel.setLayout(new BorderLayout()); staticVersioningPanel.add(staticVersioningTextArea, "Center"); staticVersioningPanel.setBorder(new LineBorder(Color.black)); dynamicVersioningPanel.setLayout(new BorderLayout()); dynamicVersioningPanel.add(dynamicVersioningTextArea, "Center"); dynamicVersioningPanel.setBorder(new LineBorder(Color.black)); if (converter.isStaticVersioning()) { staticVersioningRadioButton.setSelected(true); } else { dynamicVersioningRadioButton.setSelected(true); } addListeners(); final int buf = 10, // Buffer (between components and form) sp = 10, // Space between components vsp = 5, // Vertical space indent = 20; // Indent between form (left edge) and component GridBagConstraints gbc = new GridBagConstraints(); GridBagLayout gbl = new GridBagLayout(); getContentPane().setLayout(gbl); // // Setup top panel // GridBagLayout topLayout = new GridBagLayout(); JPanel topPanel = new JPanel(); topPanel.setOpaque(false); topPanel.setLayout(topLayout); topLayout.setConstraints( dirLabel, new GridBagConstraints( 0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0)); topLayout.setConstraints( dirTF, new GridBagConstraints( 1, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(vsp, 2, 0, 0), 0, 0)); topLayout.setConstraints( dirBttn, new GridBagConstraints( 2, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, sp, 0, 0), 0, 0)); topLayout.setConstraints( matchingLabel, new GridBagConstraints( 0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0)); topLayout.setConstraints( matchingTF, new GridBagConstraints( 1, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(vsp, 2, 0, 0), 0, 0)); topLayout.setConstraints( recursiveCheckBox, new GridBagConstraints( 2, 1, GridBagConstraints.REMAINDER, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(vsp, 10, 0, 0), 0, 0)); topLayout.setConstraints( backupLabel, new GridBagConstraints( 0, 3, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0)); topLayout.setConstraints( backupTF, new GridBagConstraints( 1, 3, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(vsp, 2, 0, 0), 0, 0)); topLayout.setConstraints( backupBttn, new GridBagConstraints( 2, 3, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, sp, 0, 0), 0, 0)); topLayout.setConstraints( templateLabel, new GridBagConstraints( 0, 4, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0)); topLayout.setConstraints( templateCh, new GridBagConstraints( 1, 4, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(vsp, 2, 0, 0), 0, 0)); topLayout.setConstraints( sep1, new GridBagConstraints( 0, 5, GridBagConstraints.REMAINDER, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0)); topLayout.setConstraints( staticVersioningLabel, new GridBagConstraints( 0, 6, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0)); topLayout.setConstraints( staticVersioningRadioButton, new GridBagConstraints( 0, 7, GridBagConstraints.REMAINDER, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(vsp, 10, 0, 0), 0, 0)); topLayout.setConstraints( staticVersioningPanel, new GridBagConstraints( 0, 8, GridBagConstraints.REMAINDER, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(vsp, 25, 10, 0), 0, 0)); topLayout.setConstraints( dynamicVersioningRadioButton, new GridBagConstraints( 0, 9, GridBagConstraints.REMAINDER, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(vsp, 10, 0, 0), 0, 0)); topLayout.setConstraints( dynamicVersioningPanel, new GridBagConstraints( 0, 10, GridBagConstraints.REMAINDER, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(vsp, 25, 0, 0), 0, 0)); topLayout.setConstraints( sep2, new GridBagConstraints( 0, 11, GridBagConstraints.REMAINDER, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 0, 10), 0, 0)); invisibleBttn = new JButton(); invisibleBttn.setVisible(false); topLayout.setConstraints( invisibleBttn, new GridBagConstraints( 2, 6, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.CENTER, new Insets(indent, sp, 0, 0), 0, 0)); topPanel.add(dirLabel); topPanel.add(dirTF); topPanel.add(dirBttn); topPanel.add(matchingLabel); topPanel.add(matchingTF); topPanel.add(recursiveCheckBox); topPanel.add(backupLabel); topPanel.add(backupTF); topPanel.add(backupBttn); topPanel.add(templateLabel); topPanel.add(templateCh); topPanel.add(sep1); topPanel.add(staticVersioningLabel); topPanel.add(staticVersioningRadioButton); topPanel.add(staticVersioningPanel); topPanel.add(dynamicVersioningRadioButton); topPanel.add(dynamicVersioningPanel); topPanel.add(sep2); topPanel.add(invisibleBttn); // // Setup bottom panel // GridBagLayout buttomLayout = new GridBagLayout(); JPanel buttomPanel = new JPanel(); buttomPanel.setOpaque(false); buttomPanel.setLayout(buttomLayout); buttomLayout.setConstraints( runBttn, new GridBagConstraints( 3, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(sp, 0, 0, 0), 0, 0)); buttomPanel.add(runBttn); // // Setup main panel // GridBagLayout mainLayout = new GridBagLayout(); JPanel mainPanel = new JPanel(); mainPanel.setOpaque(false); mainPanel.setLayout(mainLayout); mainLayout.setConstraints( topPanel, new GridBagConstraints( 0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(buf, buf, 0, buf), 0, 0)); mainLayout.setConstraints( buttomPanel, new GridBagConstraints( 0, 1, 1, 1, 1, 1, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, buf, buf, buf), 0, 0)); mainPanel.add(topPanel); mainPanel.add(buttomPanel); Border border = BorderFactory.createEtchedBorder(); mainPanel.setBorder(border); GridBagLayout layout = new GridBagLayout(); getContentPane().setLayout(layout); layout.setConstraints( mainPanel, new GridBagConstraints( 0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); getContentPane().add(mainPanel); pack(); setResizable(false); }
public MCMCPanel(BeautiFrame parent) { setLayout(new BorderLayout()); // Mac OS X components have more spacing round them already optionsPanel = new OptionsPanel(12, (OSType.isMac() ? 6 : 24)); this.frame = parent; setOpaque(false); optionsPanel.setOpaque(false); chainLengthField.setValue(100000); chainLengthField.setColumns(10); optionsPanel.addComponentWithLabel("Length of chain:", chainLengthField); chainLengthField.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { options.chainLength = chainLengthField.getValue(); frame.setDirty(); } }); optionsPanel.addSeparator(); echoEveryField.setValue(1000); echoEveryField.setColumns(10); optionsPanel.addComponentWithLabel("Echo state to screen every:", echoEveryField); echoEveryField.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { options.echoEvery = echoEveryField.getValue(); frame.setDirty(); } }); logEveryField.setValue(100); logEveryField.setColumns(10); optionsPanel.addComponentWithLabel("Log parameters every:", logEveryField); logEveryField.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { options.logEvery = logEveryField.getValue(); frame.setDirty(); } }); optionsPanel.addSeparator(); fileNameStemField.setColumns(32); optionsPanel.addComponentWithLabel("File name stem:", fileNameStemField); fileNameStemField.setEditable(true); fileNameStemField.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { options.fileNameStem = fileNameStemField.getText(); updateOtherFileNames(options); frame.setDirty(); } }); optionsPanel.addComponent(addTxt); if (OSType.isWindows()) { addTxt.setSelected(true); } else { addTxt.setSelected(false); } addTxt.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { setOptions(options); frame.setDirty(); } }); optionsPanel.addSeparator(); logFileNameField.setColumns(32); optionsPanel.addComponentWithLabel("Log file name:", logFileNameField); logFileNameField.setEditable(false); // optionsPanel.addComponent(allowOverwriteLogCheck); // allowOverwriteLogCheck.setSelected(false); // allowOverwriteLogCheck.addChangeListener(new ChangeListener() { // public void stateChanged(ChangeEvent changeEvent) { // options.allowOverwriteLog = allowOverwriteLogCheck.isSelected(); // } // }); treeFileNameField.setColumns(32); optionsPanel.addComponentWithLabel("Trees file name:", treeFileNameField); treeFileNameField.setEditable(false); // addComponent(mapTreeLogCheck); // mapTreeLogCheck.setOpaque(false); // mapTreeLogCheck.addActionListener(new java.awt.event.ActionListener() { // public void actionPerformed(ActionEvent e) { // mapTreeFileNameField.setEnabled(mapTreeLogCheck.isSelected()); // } // }); // // mapTreeFileNameField.setColumns(32); // addComponentWithLabel("MAP tree file name:", mapTreeFileNameField); optionsPanel.addComponent(substTreeLogCheck); substTreeLogCheck.setOpaque(false); substTreeLogCheck.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { options.substTreeLog = substTreeLogCheck.isSelected(); updateTreeFileNameList(); substTreeFileNameField.setEnabled(substTreeLogCheck.isSelected()); if (substTreeLogCheck.isSelected()) { substTreeFileNameField.setText(displayTreeList(options.substTreeFileName)); } else { substTreeFileNameField.setText(""); } frame.setDirty(); } }); substTreeFileNameField.setColumns(32); substTreeFileNameField.setEditable(false); substTreeFileNameField.setEnabled(false); optionsPanel.addComponentWithLabel("Substitutions trees file name:", substTreeFileNameField); optionsPanel.addComponent(operatorAnalaysisCheck); operatorAnalaysisCheck.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { options.operatorAnalysis = operatorAnalaysisCheck.isSelected(); updateOtherFileNames(options); frame.setDirty(); } }); operatorAnalaysisFileNameField.setColumns(32); operatorAnalaysisFileNameField.setEditable(false); operatorAnalaysisFileNameField.setEnabled(false); optionsPanel.addComponentWithLabel( "Operator analysis file name:", operatorAnalaysisFileNameField); optionsPanel.addSeparator(); optionsPanel.addComponent(samplePriorCheckBox); samplePriorCheckBox.setOpaque(false); samplePriorCheckBox.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { frame.setDirty(); } }); // logFileNameField.addKeyListener(listener); // treeFileNameField.addKeyListener(listener); // mapTreeFileNameField.addKeyListener(listener); // substTreeFileNameField.addKeyListener(listener); // optionsPanel.setPreferredSize(new java.awt.Dimension(500, 600)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); panel.add(optionsPanel, BorderLayout.CENTER); panel.setOpaque(false); JScrollPane scrollPane = new JScrollPane( panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setOpaque(false); scrollPane.setBorder(null); scrollPane.getViewport().setOpaque(false); add(scrollPane, BorderLayout.CENTER); }
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); }
/** * Returns the main control panel. * * @param mainFrame The main test frame. * @param mainTabbedPane The main tabbed pane. * @param mainTabPreviewPainter The preview painter of the main tabbed pane. * @param toolbar The toolbar of the main test frame. * @return The main control panel. */ public static JPanel getMainControlPanel( final JFrame mainFrame, final JTabbedPane mainTabbedPane, final MyMainTabPreviewPainter mainTabPreviewPainter, final JToolBar toolbar) { FormLayout lm = new FormLayout("right:pref, 4dlu, fill:pref:grow", ""); DefaultFormBuilder builder = new DefaultFormBuilder(lm); // builder.setDefaultDialogBorder(); builder.appendSeparator("Title pane settings"); final JCheckBox markAsModified = new JCheckBox("Marked modified"); markAsModified.setOpaque(false); markAsModified.setSelected(false); markAsModified.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mainFrame .getRootPane() .putClientProperty( SubstanceLookAndFeel.WINDOW_MODIFIED, (markAsModified.isSelected() ? Boolean.TRUE : false)); } }); builder.append("Modified", markAsModified); final JCheckBox heapPanel = new JCheckBox("Has heap panel"); heapPanel.setOpaque(false); heapPanel.setSelected(false); heapPanel.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SubstanceLookAndFeel.setWidgetVisible( mainFrame.getRootPane(), heapPanel.isSelected(), SubstanceWidgetType.TITLE_PANE_HEAP_STATUS); } }); builder.append("Heap panel", heapPanel); JButton changeTitleButton = new JButton("Change"); changeTitleButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String random = "abcdefghijklmnopqrstuvwxyz "; int length = 60 + (int) (150 * Math.random()); String title = ""; while (length > 0) { title += random.charAt((int) (random.length() * Math.random())); length--; } mainFrame.setTitle(title); } }); builder.append("Title string", changeTitleButton); builder.appendSeparator("Miscellaneous"); final JCheckBox defaultRoundedCorners = new JCheckBox("by default"); defaultRoundedCorners.setOpaque(false); boolean roundable = Boolean.valueOf( System.getProperty(SubstanceLookAndFeel.WINDOW_ROUNDED_CORNERS_PROPERTY, "True")); defaultRoundedCorners.setSelected(roundable); defaultRoundedCorners.setEnabled(roundable); defaultRoundedCorners.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UIManager.put( SubstanceLookAndFeel.WINDOW_ROUNDED_CORNERS, defaultRoundedCorners.isSelected()); } }); builder.append("Rounded Windows", defaultRoundedCorners); final JCheckBox useThemedDefaultIconsCheckBox = new JCheckBox("use themed icons"); useThemedDefaultIconsCheckBox.setOpaque(false); useThemedDefaultIconsCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { UIManager.put( SubstanceLookAndFeel.USE_THEMED_DEFAULT_ICONS, useThemedDefaultIconsCheckBox.isSelected() ? Boolean.TRUE : null); mainFrame.repaint(); } }); } }); builder.append("Themed icons", useThemedDefaultIconsCheckBox); final JCheckBox useConstantThemesOnDialogs = new JCheckBox("use constant themes"); useConstantThemesOnDialogs.setOpaque(false); useConstantThemesOnDialogs.setSelected(SubstanceLookAndFeel.isToUseConstantThemesOnDialogs()); useConstantThemesOnDialogs.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { SubstanceLookAndFeel.setToUseConstantThemesOnDialogs( useConstantThemesOnDialogs.isSelected()); SubstanceLookAndFeel.setSkin( SubstanceLookAndFeel.getCurrentSkin(mainFrame.getRootPane())); } }); } }); builder.append("Option pane icons", useConstantThemesOnDialogs); final JComboBox placementCombo = new JComboBox(new Object[] {"top", "bottom", "left", "right"}); placementCombo.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String selected = (String) placementCombo.getSelectedItem(); if ("top".equals(selected)) mainTabbedPane.setTabPlacement(JTabbedPane.TOP); if ("bottom".equals(selected)) mainTabbedPane.setTabPlacement(JTabbedPane.BOTTOM); if ("left".equals(selected)) mainTabbedPane.setTabPlacement(JTabbedPane.LEFT); if ("right".equals(selected)) mainTabbedPane.setTabPlacement(JTabbedPane.RIGHT); } }); builder.append("Placement", placementCombo); try { final JComboBox overviewKindCombo = new FlexiComboBox<TabOverviewKind>( TabOverviewKind.GRID, TabOverviewKind.MENU_CAROUSEL, TabOverviewKind.ROUND_CAROUSEL) { @Override public String getCaption(TabOverviewKind item) { return item.getName(); } }; overviewKindCombo.setSelectedItem( LafWidgetUtilities2.getTabPreviewPainter(mainTabbedPane).getOverviewKind(mainTabbedPane)); overviewKindCombo.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mainTabPreviewPainter.setTabOverviewKind( (TabOverviewKind) overviewKindCombo.getSelectedItem()); } }); builder.append("Overview kind", overviewKindCombo); } catch (NoClassDefFoundError ignored) { } final JComboBox menuGutterFillCombo = new FlexiComboBox<MenuGutterFillKind>( MenuGutterFillKind.NONE, MenuGutterFillKind.SOFT, MenuGutterFillKind.HARD, MenuGutterFillKind.SOFT_FILL, MenuGutterFillKind.HARD_FILL) { @Override public String getCaption(MenuGutterFillKind item) { return item.name(); } }; menuGutterFillCombo.setSelectedItem(MenuGutterFillKind.HARD); menuGutterFillCombo.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UIManager.put( SubstanceLookAndFeel.MENU_GUTTER_FILL_KIND, menuGutterFillCombo.getSelectedItem()); } }); builder.append("Menu fill", menuGutterFillCombo); final JComboBox focusKindCombo = new FlexiComboBox<FocusKind>(FocusKind.values()) { @Override public String getCaption(FocusKind item) { return item.name(); } }; focusKindCombo.setSelectedItem(FocusKind.ALL_INNER); focusKindCombo.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UIManager.put(SubstanceLookAndFeel.FOCUS_KIND, focusKindCombo.getSelectedItem()); } }); builder.append("Focus kind", focusKindCombo); JButton buttonGlassPane = new JButton("Show"); buttonGlassPane.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final JPanel glassPane = new JPanel() { @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D graphics = (Graphics2D) g; int height = getHeight(); int width = getWidth(); Composite c = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) 0.4); graphics.setComposite(c); for (int i = 0; i < height; i++) { Color color = (i % 2 == 0) ? new Color(200, 200, 255) : new Color(230, 230, 255); graphics.setColor(color); graphics.drawLine(0, i, width, i); } Composite c2 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) 1.0); graphics.setComposite(c2); } }; glassPane.setOpaque(false); glassPane.addMouseListener(new MouseAdapter() {}); glassPane.addKeyListener(new KeyAdapter() {}); mainFrame.setGlassPane(glassPane); new Thread() { @Override public void run() { glassPane.setVisible(true); try { Thread.sleep(5000); } catch (InterruptedException ie) { ie.printStackTrace(); } glassPane.setVisible(false); } }.start(); } }); builder.append("Glass pane", buttonGlassPane); builder.appendSeparator("Custom animations"); final JCheckBox allowFocusLoopAnimations = new JCheckBox("Allow animation"); allowFocusLoopAnimations.setOpaque(false); allowFocusLoopAnimations.setSelected( AnimationConfigurationManager.getInstance() .isAnimationAllowed(AnimationFacet.FOCUS_LOOP_ANIMATION, null)); allowFocusLoopAnimations.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (allowFocusLoopAnimations.isSelected()) { AnimationConfigurationManager.getInstance() .allowAnimations(AnimationFacet.FOCUS_LOOP_ANIMATION); } else { AnimationConfigurationManager.getInstance() .disallowAnimations(AnimationFacet.FOCUS_LOOP_ANIMATION); } } }); builder.append("Focus loop", allowFocusLoopAnimations); final JCheckBox allowGlowIconAnimations = new JCheckBox("Allow animation"); allowGlowIconAnimations.setOpaque(false); allowGlowIconAnimations.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (allowGlowIconAnimations.isSelected()) { AnimationConfigurationManager.getInstance().allowAnimations(AnimationFacet.ICON_GLOW); } else { AnimationConfigurationManager.getInstance() .disallowAnimations(AnimationFacet.ICON_GLOW); } } }); builder.append("Icon glow", allowGlowIconAnimations); final JCheckBox allowGhostIconAnimations = new JCheckBox("Allow animation"); allowGhostIconAnimations.setOpaque(false); allowGhostIconAnimations.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (allowGhostIconAnimations.isSelected()) { AnimationConfigurationManager.getInstance() .allowAnimations(AnimationFacet.GHOSTING_ICON_ROLLOVER); } else { AnimationConfigurationManager.getInstance() .disallowAnimations(AnimationFacet.GHOSTING_ICON_ROLLOVER); } } }); builder.append("Icon rollover", allowGhostIconAnimations); final JCheckBox allowGhostPressAnimations = new JCheckBox("Allow animation"); allowGhostPressAnimations.setOpaque(false); allowGhostPressAnimations.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (allowGhostPressAnimations.isSelected()) { AnimationConfigurationManager.getInstance() .allowAnimations(AnimationFacet.GHOSTING_BUTTON_PRESS); } else { AnimationConfigurationManager.getInstance() .disallowAnimations(AnimationFacet.GHOSTING_BUTTON_PRESS); } } }); builder.append("Button press", allowGhostPressAnimations); builder.appendSeparator("Toolbar"); final JCheckBox isToolbarFlat = new JCheckBox("Is flat"); isToolbarFlat.setOpaque(false); isToolbarFlat.setSelected(true); isToolbarFlat.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { toolbar.putClientProperty( SubstanceLookAndFeel.FLAT_PROPERTY, isToolbarFlat.isSelected()); toolbar.repaint(); } }); builder.append("Flat", isToolbarFlat); builder.appendSeparator("Menu bar"); final JCheckBox menuSearch = new JCheckBox("Has menu search"); menuSearch.setOpaque(false); menuSearch.setSelected(false); menuSearch.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SubstanceLookAndFeel.setWidgetVisible( mainFrame.getRootPane(), menuSearch.isSelected(), SubstanceWidgetType.MENU_SEARCH); } }); builder.append("Menu search", menuSearch); final JCheckBox menuLocale = new JCheckBox("Has custom locale"); menuLocale.setOpaque(false); menuLocale.setSelected(false); menuLocale.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (menuLocale.isSelected()) { mainFrame.getJMenuBar().setLocale(Locale.FRENCH); mainFrame .getJMenuBar() .putClientProperty(LafWidget.IGNORE_GLOBAL_LOCALE, Boolean.TRUE); } else { mainFrame.getJMenuBar().putClientProperty(LafWidget.IGNORE_GLOBAL_LOCALE, null); } } }); builder.append("Menu locale", menuLocale); JPanel result = builder.getPanel(); result.setName("Main control panel"); return result; }