private void newComps() { ta = new JTextArea(); // ta.setLineWrap(true); ta.setWrapStyleWord(true); ta.setFocusable(false); ta.setEditable(false); ta.setFont(new Font("Courier New", Font.BOLD, 20)); ta.setBackground(Color.black); ta.setForeground(Color.GREEN); sc = new JScrollPane(); sc.setViewportView(ta); btnExport = new JButton("Export"); btnExport.setOpaque(false); btnExport.setFont(ta.getFont()); btnExport.setFocusable(false); ckWrap = new JCheckBox("Wrap text"); ckWrap.setOpaque(false); ckWrap.setForeground(Color.white); ckWrap.setFont(ta.getFont()); ckWrap.setFocusable(false); chooser = new JFileChooser(); }
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)); }
public BooleanPMListCellRenderer() { cb.setHorizontalAlignment(SwingConstants.CENTER); cb.setBorderPainted(false); cb.setOpaque(false); this.setLayout(new BorderLayout()); this.add(this.cb, BorderLayout.CENTER); }
@Override public JComponent createCustomComponent(Presentation presentation) { // this component cannot be stored right here because of action system architecture: // one action can be shown on multiple toolbars simultaneously JCheckBox checkBox = new JCheckBox(); checkBox.setOpaque(false); checkBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JCheckBox checkBox = (JCheckBox) e.getSource(); ActionToolbar actionToolbar = UIUtil.getParentOfType(ActionToolbar.class, checkBox); DataContext dataContext = actionToolbar != null ? actionToolbar.getToolbarDataContext() : DataManager.getInstance().getDataContext(checkBox); CheckboxAction.this.actionPerformed( new AnActionEvent( null, dataContext, ActionPlaces.UNKNOWN, CheckboxAction.this.getTemplatePresentation(), ActionManager.getInstance(), 0)); } }); return checkBox; }
public BlockHostsPanel() { super(I18n.tr("Block Hosts")); setLayout(new MigLayout("gapy 10", "[sg 1][sg 1][]", "")); addressTextField = new JTextField(26); addButton = new JButton(I18n.tr("Add Address")); filterTable = new FilteringTable(); backListCheckBox = new JCheckBox(); backListCheckBox.setOpaque(false); addButton.addActionListener(new AddAction(addressTextField, filterTable)); add( new JLabel( "<html>" + I18n.tr("Block contact with specific people by adding their IP address") + "</html>"), "span, growx, wrap"); add(addressTextField, "gapright 10"); add(addButton, "wrap"); add(new JScrollPane(filterTable), "growx, span 2, wrap"); add(backListCheckBox, "span, split"); add( new MultiLineLabel(description, ReallyAdvancedOptionPanel.MULTI_LINE_LABEL_WIDTH), "wrap"); }
public HeaderRenderer2(JTableHeader header, final int index) { // index is the column to be modified check.setOpaque(false); check.setFont(header.getFont()); header.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { JTable table = ((JTableHeader) e.getSource()).getTable(); TableColumnModel columnModel = table.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int modelColumn = table.convertColumnIndexToModel(viewColumn); if (modelColumn == index) { check.setSelected(!check.isSelected()); TableModel m = table.getModel(); Boolean f = check.isSelected(); for (int i = 0; i < m.getRowCount(); i++) { m.setValueAt(f, i, index); } ((JTableHeader) e.getSource()).repaint(); } else { return; } } }); }
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; }
@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 OrderItem(ExpressOrderVO expressorder) { setOpaque(false); this.expressorder = expressorder; check = new JCheckBox(); check.setOpaque(false); check.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { // TODO 自动生成的方法存根 if (e.getStateChange() == ItemEvent.SELECTED) { selected(); } else { deSelected(); } } }); order_id = new GAPTextField(expressorder.order_id, 12); order_id.setCenter(); order_id.closeEdit(); target_add = new GAPTextField(expressorder.receiver_info.getDepart(), 20); target_add.setCenter(); target_add.closeEdit(); gb = new GridBagLayout(); gcons = new GridBagConstraints(); setLayout(gb); SwingConsole.addComponent(gb, gcons, this, check, 0, 0, 1, 1, 0, 0); SwingConsole.addComponent(gb, gcons, this, order_id, 1, 0, 1, 1, 0.5, 0); SwingConsole.addComponent(gb, gcons, this, target_add, 2, 0, 1, 1, 0.5, 0); }
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); }
/** Configures a checkbox with the properties of tree cell renderes. */ private static JCheckBox configureCheckBox(JCheckBox checkBox) { checkBox.setHorizontalAlignment(JCheckBox.LEFT); checkBox.setFont(UIManager.getFont("Tree.font")); checkBox.setBorderPainted(false); checkBox.setFocusPainted(false); checkBox.setFocusable(false); checkBox.setOpaque(false); return checkBox; }
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); }
/** Creates an image of the checkbox and puts it in a label. */ private JLabel createIconLabel(JCheckBox checkBox) { checkBox.setOpaque(false); checkBox.setSize(checkBox.getMinimumSize()); Image image = new BufferedImage(checkBox.getWidth(), checkBox.getHeight(), Transparency.TRANSLUCENT); Graphics g = image.getGraphics(); checkBox.paint(g); g.dispose(); return new JLabel(new ImageIcon(image)); }
public void setJCheckbox(JCheckBox jcb) { jcb.setOpaque(false); jcb.setBorder(null); jcb.setBorderPainted(false); jcb.setMargin(new Insets(0, 0, 0, 0)); jcb.setContentAreaFilled(false); jcb.setFocusable(false); jcb.setFont(new Font("ËÎÌå", 0, 12)); jcb.addMouseListener(new ButtonListener()); }
public CheckBoxField( String name, String description, String defaultValue, boolean isChecked, String tip) { box = new JCheckBox(); box.setText(description); this.setName(name); box.setSelected(isChecked); box.setOpaque(true); tf = new JTextField(); tf = createTextField(defaultValue); }
@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 CheckBoxCellRenderer() { super(); if (noFocusBorder == null) { noFocusBorder = new EmptyBorder(1, 1, 1, 1); } checkBox = new JCheckBox(); checkBox.addItemListener(this); checkBox.setOpaque(true); checkBox.setBorder(noFocusBorder); }
public SchemaTabs() { super(); conflicts = new JPanel(); conflicts.setLayout(new BorderLayout()); auto = new JCheckBox("Auto-Resolve"); auto.setToolTipText("Automatically modify inferred schema from received Responses"); auto.setOpaque(false); UISupport.setFixedSize(auto, 120, 20); XmlBeansSettingsImpl settings = getRequest().getSettings(); if (settings.isSet(AUTO_INFER_SCHEMAS)) { auto.setSelected(settings.getBoolean(AUTO_INFER_SCHEMAS)); } auto.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { getRequest().getSettings().setBoolean(AUTO_INFER_SCHEMAS, auto.isSelected()); } }); resolveButton = new JButton("Resolve conflicts"); resolveButton.setEnabled(false); resolveButton.setActionCommand("resolve"); resolveButton.addActionListener(this); JXToolBar toolbar = UISupport.createToolbar(); toolbar.addFixed(auto); toolbar.addFixed(resolveButton); log = new JLogList("Schema log"); conflicts.add(toolbar, BorderLayout.NORTH); conflicts.add(log, BorderLayout.CENTER); addTab("Conflicts", conflicts); schemaList = new JList(InferredSchemaManager.getInferredSchema(service).getNamespaces()); schemaList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); schemaList.addListSelectionListener(this); toolbar = UISupport.createToolbar(); toolbar.addFixed(UISupport.createToolbarButton(new RemoveNamespaceAction())); JPanel listPanel = new JPanel(); listPanel.setLayout(new BorderLayout()); listPanel.add(toolbar, BorderLayout.NORTH); listPanel.add(new JScrollPane(schemaList), BorderLayout.CENTER); xsd = JXEditTextArea.createXmlEditor(false); xsd.setEditable(false); update(); addTab( "Schemas", new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, listPanel, new JScrollPane(xsd))); }
protected void addPostQueryCheckBox(JXToolBar toolbar) { postQueryCheckBox = new JCheckBox("Post QueryString", httpRequest.isPostQueryString()); postQueryCheckBox.setToolTipText("Controls if Query-parameters should be put in message body"); postQueryCheckBox.setOpaque(false); postQueryCheckBox.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { httpRequest.setPostQueryString(postQueryCheckBox.isSelected()); enableBodyComponents(); } }); postQueryCheckBox.setPreferredSize(new Dimension(130, 20)); toolbar.addFixed(postQueryCheckBox); }
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JPanel panel = new JPanel(); JCheckBox checkBox = new JCheckBox(); panel.setLayout(new BorderLayout()); panel.setOpaque(false); checkBox.setOpaque(false); Component renderer = delegateRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); checkBox.setSelected(model.isSelectedIndex(index)); panel.add(checkBox, BorderLayout.WEST); panel.add(renderer, BorderLayout.CENTER); panel.setToolTipText(((JLabel) renderer).getToolTipText()); return panel; }
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; }
@Override protected Component buildContent() { JPanel mainPanel = new JPanel(new BorderLayout()); JSplitPane splitPane = UISupport.createHorizontalSplit(buildCategoriesList(), buildAssertionsList()); splitPane.setDividerLocation(220); getAssertionsTable().setSelectable(true); JXToolBar toolbar = UISupport.createSmallToolbar(); hideDescCB = new JCheckBox("Hide descriptions"); hideDescCB.setOpaque(false); hideDescCB.addItemListener(hideDescListener); hideDescCB.setSelected( SoapUI.getSettings().getBoolean(AssertionDescriptionSettings.SHOW_ASSERTION_DESCRIPTION)); toolbar.add(new JLabel("Assertions")); toolbar.addGlue(); toolbar.add(hideDescCB); mainPanel.add(toolbar, BorderLayout.NORTH); mainPanel.add(splitPane, BorderLayout.CENTER); return mainPanel; }
public IECheckBoxWidgetView( IEController ieController, IECheckBoxWidget model, boolean addDnDSupport, IEWOComponentView view) { super(ieController, model, addDnDSupport, view); FlowLayout layout = new FlowLayout(FlowLayout.LEFT, 0, 0); setLayout(layout); _jCheckBox = new JCheckBox(); _jCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { isUpdatingModel = true; getCheckBoxModel().setValue(((JCheckBox) e.getSource()).isSelected()); isUpdatingModel = false; } }); _jCheckBox.setFont(TEXTFIELD_FONT); container = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4)); container.setOpaque(false); container.add(_jCheckBox); add(container); _jCheckBox.setEnabled(true); _jCheckBox.setFocusable(false); _jCheckBox.setOpaque(false); if (getCheckBoxModel().getDescription() != null) { _jCheckBox.setToolTipText(getCheckBoxModel().getDescription()); } TransparentMouseListener tml = new TransparentMouseListener(_jCheckBox, this); _jCheckBox.addMouseListener(tml); _jCheckBox.addMouseMotionListener(tml); _jCheckBox.setSelected(getCheckBoxModel().getValue()); _jCheckBox.setBackground(getBackgroundColor()); setBackground(getBackgroundColor()); revalidate(); }
/** Create a per-tree instance of the checkbox renderer. */ public CheckBoxTreeCellRenderer(final JTree tree) { this.tree = tree; this.tree.addKeyListener( new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { int[] rows = tree.getSelectionRows(); if (rows == null) return; for (int i : rows) { toggleChecked(i); } } } }); this.renderer = tree.getCellRenderer(); checkedPaths = new HashSet<TreePath>(); checkBox = new JCheckBox(); checkBox.setOpaque(false); checkBox.setSize(checkBox.getPreferredSize()); listenerList = new EventListenerList(); }
/** Initializes the toolbar buttons */ protected void init() { super.init(); markerButton.setEnabled(false); quickFilterTextField.setMaximumSize(new Dimension(250, 20)); quickFilterTextField.setToolTipText("Quick filter"); regularExpressionCheckBox.setOpaque(false); regularExpressionCheckBox.setToolTipText("Treat the filter text as a regular expression"); add(quickFilterTextField); add(regularExpressionCheckBox); addDividerButton(); add(debugButton); add(infoButton); add(warnButton); add(errorButton); add(fatalButton); addDividerButton(); add(markerButton); add(prevMarkedButton); add(nextMarkedButton); addDividerButton(); add(playButton); add(deleteButton); registerListeners(); }
private BooleanRW() { panel.setLayout(new BorderLayout()); panel.add(BorderLayout.CENTER, component); component.setOpaque(false); }
/** * 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); }
EditorPane(QueryExecutorCreator queryExecutorCreator) { super(new BorderLayout()); this.queryExecutorCreator = queryExecutorCreator; setOpaque(false); JPanel northPanel = new JPanel(new BorderLayout()); northPanel.setOpaque(false); JToolBar northWestPanel = new JToolBar(); northWestPanel.setOpaque(false); northWestPanel.setFloatable(false); startButton = new JButton( new ImageIcon(getClass().getResource("/org/jooq/debug/console/resources/Play16.png"))); startButton.setOpaque(false); startButton.setFocusable(false); // startButton.setMargin(new Insets(2, 2, 2, 2)); startButton.setToolTipText("Run the (selected) text (F5)"); startButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { evaluateInternal(); } }); northWestPanel.add(startButton); stopButton = new JButton( new ImageIcon(getClass().getResource("/org/jooq/debug/console/resources/Stop16.png"))); stopButton.setVisible(false); stopButton.setOpaque(false); stopButton.setFocusable(false); // stopButton.setMargin(new Insets(2, 2, 2, 2)); stopButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { closeLastExecution(); } }); northWestPanel.add(stopButton); northPanel.add(northWestPanel, BorderLayout.WEST); JPanel northEastPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 2)); northEastPanel.setOpaque(false); JCheckBox limitCheckBox = new JCheckBox("Parse 10000 rows max", isUsingMaxRowCount); limitCheckBox.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { isUsingMaxRowCount = e.getStateChange() == ItemEvent.SELECTED; } }); limitCheckBox.setOpaque(false); northEastPanel.add(limitCheckBox); northEastPanel.add(Box.createHorizontalStrut(5)); northEastPanel.add(new JLabel("No display when rows >")); NumberFormat numberFormat = NumberFormat.getIntegerInstance(); displayedRowCountField = new JFormattedTextField(numberFormat); displayedRowCountField.setHorizontalAlignment(JFormattedTextField.RIGHT); displayedRowCountField.setValue(100000); displayedRowCountField.setColumns(7); northEastPanel.add(displayedRowCountField); northPanel.add(northEastPanel, BorderLayout.CENTER); add(northPanel, BorderLayout.NORTH); editorTextArea = new SqlTextArea(); editorTextArea.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { boolean isControlDown = e.isControlDown(); switch (e.getKeyCode()) { case KeyEvent.VK_SPACE: if (isControlDown) { showCompletion(); } break; case KeyEvent.VK_F5: if (startButton.isVisible()) { evaluateInternal(); } break; case KeyEvent.VK_ESCAPE: new Thread("SQLConsole - Interruption") { @Override public void run() { closeLastExecution(); } }.start(); break; } } }); RTextScrollPane editorTextAreaScrollPane = new RTextScrollPane(editorTextArea); southPanel = new JPanel(new BorderLayout()); southPanel.setOpaque(false); JSplitPane verticalSplitPane = new InvisibleSplitPane( JSplitPane.VERTICAL_SPLIT, true, editorTextAreaScrollPane, southPanel); verticalSplitPane.setOpaque(false); add(verticalSplitPane, BorderLayout.CENTER); verticalSplitPane.setDividerLocation(150); }
public BreakpointHitEditor( final Debugger debugger, final DebuggerPane debuggerPane, final BreakpointHitNode breakpointHitNode) { super(new BorderLayout()); setOpaque(false); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setOpaque(false); JPanel breakpointHitExecutionPane = new JPanel(new GridBagLayout()); breakpointHitExecutionPane.setBorder(BorderFactory.createEmptyBorder(2, 5, 5, 5)); breakpointHitExecutionPane.setOpaque(false); hit = breakpointHitNode.getUserObject(); int y = 0; breakpointHitExecutionPane.add( new JLabel("Query:"), new GridBagConstraints( 0, y++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); SqlTextArea sqlTextArea = new SqlTextArea(); String sql = hit.getSQL(); String parameterDescription = hit.getParameterDescription(); if (parameterDescription != null) { sql += "\n -> " + parameterDescription; } sqlTextArea.setText(sql + "\n"); sqlTextArea.setCaretPosition(0); breakpointHitExecutionPane.add( new RTextScrollPane(sqlTextArea), new GridBagConstraints( 0, y++, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); if (hit.isBeforeExecution()) { replaceCheckbox = new JCheckBox("Replace with statement"); replaceCheckbox.setOpaque(false); replaceCheckbox.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { adjustStates(); } }); breakpointHitExecutionPane.add( replaceCheckbox, new GridBagConstraints( 0, y++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0)); replaceTextArea = new SqlTextArea(); replacePane = new RTextScrollPane(replaceTextArea); breakpointHitExecutionPane.add( replacePane, new GridBagConstraints( 0, y++, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 20, 0, 0), 0, 0)); } JPanel executionTypePane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); // For now, this choice is not exposed. executionTypePane.setVisible(hit.isBeforeExecution()); executionTypePane.setOpaque(false); ButtonGroup executionTypeGroup = new ButtonGroup(); final JRadioButton executeTypeNoneRadioButton = new JRadioButton("Execute"); executeTypeNoneRadioButton.setOpaque(false); executeTypeNoneRadioButton.setSelected(true); executionTypeGroup.add(executeTypeNoneRadioButton); executionTypePane.add(executeTypeNoneRadioButton); final JRadioButton executeTypeBreakRadioButton = new JRadioButton("Execute and break"); executeTypeBreakRadioButton.setOpaque(false); executionTypeGroup.add(executeTypeBreakRadioButton); executionTypePane.add(executeTypeBreakRadioButton); final JRadioButton executeTypeSkipRadioButton = new JRadioButton("Skip"); executeTypeSkipRadioButton.setOpaque(false); executionTypeGroup.add(executeTypeSkipRadioButton); executionTypePane.add(executeTypeSkipRadioButton); final JRadioButton executeTypeFailRadioButton = new JRadioButton("Throw exception"); executeTypeFailRadioButton.setOpaque(false); executionTypeGroup.add(executeTypeFailRadioButton); executionTypePane.add(executeTypeFailRadioButton); breakpointHitExecutionPane.add( executionTypePane, new GridBagConstraints( 0, y++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0)); JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); buttonPane.setOpaque(false); buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); JButton applyButton = new JButton("Proceed"); applyButton.setOpaque(false); applyButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (hit.isBeforeExecution()) { String replacementSQL = null; ExecutionType type = RUN; if (executeTypeNoneRadioButton.isSelected()) { type = RUN; replacementSQL = replaceCheckbox.isSelected() ? replaceTextArea.getText() : null; } else if (executeTypeBreakRadioButton.isSelected()) { type = STEP; replacementSQL = replaceCheckbox.isSelected() ? replaceTextArea.getText() : null; } else if (executeTypeSkipRadioButton.isSelected()) { type = SKIP; } else if (executeTypeFailRadioButton.isSelected()) { type = FAIL; } hit.setExecutionType(type, replacementSQL); } else { hit.setExecutionType(RUN, null); } debuggerPane.proceedBreakpointHit(breakpointHitNode); } }); buttonPane.add(applyButton); breakpointHitExecutionPane.add( buttonPane, new GridBagConstraints( 0, y, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); adjustStates(); tabbedPane.addTab("Execution", breakpointHitExecutionPane); tabbedPane.addTab( "Editor", new EditorsPane( new QueryExecutorCreator() { @Override public QueryExecutor createQueryExecutor() { return debugger.createBreakpointHitStatementExecutor(hit.getThreadID()); } }, false)); add(tabbedPane); }