def __init__(self, frame, chart, pingFun): JDialog(frame) self.setTitle('Chart Settings') self.setModal(True) self.pingFun = pingFun pane = self.getRootPane().getContentPane() pane.setLayout(GridLayout(7, 2)) pane.add(JLabel('Marker color')) self.markerPanel = self.createColorPanel(chart.markerColor, pane) pane.add(JLabel('Positive selection color')) self.posPanel = self.createColorPanel(chart.posColor, pane) pane.add(JLabel('Neutral color')) self.neuPanel = self.createColorPanel(chart.neuColor, pane) pane.add(JLabel('Balancing selection color ')) self.balPanel = self.createColorPanel(chart.balColor, pane) self.add(JLabel('Label candidate selected loci')) self.selLabel = JCheckBox() self.selLabel.setSelected(chart.labelSelected) self.add(self.selLabel) self.add(JLabel('Label candidate neutral loci')) self.neuLabel = JCheckBox() self.neuLabel.setSelected(chart.labelNeutral) self.add(self.neuLabel) change = JButton('Change') change.setActionCommand('Change') change.addActionListener(self) pane.add(change) exit = JButton('Exit') exit.setActionCommand('Exit') exit.addActionListener(self) pane.add(exit) self.pack()
def __init__(self, frame, what, entries, pingFun): JDialog(frame, what) self.frame = frame self.entries = entries self.pingFun = pingFun pane = self.getRootPane().getContentPane() self.ent_pane, self.ent_list, self.ent = self.createList(entries) pane.add(self.ent_pane, BorderLayout.WEST) actionPanel = JPanel() actionPanel.setLayout(GridLayout(20, 1)) self.text = JTextField(20) actionPanel.add(self.text) change = JButton('Change') change.setActionCommand('Change') change.addActionListener(self) actionPanel.add(change) actionPanel.add(JLabel('')) quit = JButton('Exit') quit.setActionCommand('Exit') quit.addActionListener(self) actionPanel.add(quit) actionPanel.add(JLabel('')) pane.add(actionPanel, BorderLayout.CENTER) self.pack()
def word_corrections(event): words_string = "" for word in self.word_classifier.words: words_string = words_string + word.upper() + "\n" text = "The words that can be corrected are:\n\n" + words_string dialog = JOptionPane(text, JOptionPane.INFORMATION_MESSAGE) dialog_wrapper = JDialog(self, "Available Words", False) dialog_wrapper.setContentPane(dialog) dialog_wrapper.pack() dialog_wrapper.setVisible(True)
def makeDialog(self, event): cmd = event.getActionCommand() isModal = (cmd == 'Modal') dialog = JDialog( self.frame, # Try None as owner... # None, # owner title='%d: %s' % (self.boxNum, cmd), modal=isModal, size=(200, 100), locationRelativeTo=self.frame) self.boxNum += 1 dialog.add(JLabel(cmd)) dialog.setVisible(1)
def start(self): self.frame = JDialog() #self.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.frame.setLocation(0, 1500) self.frame.setSize(1000, 200) self.tableDataModel = DefaultTableModel([], [ "URL", "Code", "Content-Length", "Location", "Mutated Id", "Orig Id" ]) self.jtable = JTable(self.tableDataModel) scrollPane = JScrollPane(self.jtable) self.jtable.setFillsViewportHeight(True) messageEditorOrig = self.callbacks.createMessageEditor(None, False) messageEditorModified = self.callbacks.createMessageEditor( None, False) self.editorSplitPane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT, messageEditorOrig.getComponent(), messageEditorModified.getComponent()) self.editorSplitPane.setResizeWeight(0.5) splitPane = JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, self.editorSplitPane) splitPane.setResizeWeight(0.5) class TableSelector(ListSelectionListener): def __init__(self, plugin): self.plugin = plugin def valueChanged(self, event): if not event.getValueIsAdjusting(): selectedRowIndex = self.plugin.jtable.getSelectedRows()[0] self.plugin._rowSelected(selectedRowIndex) self.jtable.getSelectionModel().addListSelectionListener( TableSelector(self)) self.frame.add(splitPane) self.frame.setVisible(True) self.callbacks.registerHttpListener(self) self.callbacks.setExtensionName("Custom Plugin") return
def valueChanged(self, event): if not event.getValueIsAdjusting(): table = self.table row = table.getSelectedRow() if row > -1: method = table.getModel().getValueAt(row, 0) title = '%s.help( "%s" )' % (self.objName, method) text = self.WASobj.help(method) text = JTextArea(text, 20, 80, font=monoFont) dialog = JDialog( None, # owner title, # title 1, # modal = true layout=BorderLayout(), locationRelativeTo=None) dialog.add(JScrollPane(text), BorderLayout.CENTER) dialog.pack() dialog.setVisible(1)
def popup( self, event ) : self.dialog = dialog = JDialog( self.frame, 'Name prompt', 1, layout = GridLayout( 0, 2 ), locationRelativeTo = self.frame ) dialog.add( JLabel( "What's your name?" ) ) self.text = dialog.add( JTextField( 10, actionPerformed = self.enter ) ) self.result = None dialog.pack() dialog.setVisible( 1 ) self.label.setText( 'Name = "%s"' % self.result )
def __showModal(params=None): from javax.swing import JDialog windowName = 'GWFileBrowser' if windowName in system.gui.getWindowNames(): window = system.nav.openWindowInstance(windowName, params) system.nav.centerWindow(window) rc = window.getRootContainer() #rc.load() cp = window.getContentPane() window.setVisible(False) dlg = JDialog(None, True) dlg.setContentPane(cp) dlg.setSize(window.getWidth(), window.getHeight()) dlg.setMinimumSize(window.getMinimumSize()) dlg.setMaximumSize(window.getMaximumSize()) dlg.setLocation(window.getX(), window.getY()) #dlg.setLocationRelativeTo(None) dlg.setTitle(window.getTitle()) dlg.setVisible(True) system.nav.closeWindow(window) return rc.Result return None
def __init__(self, frame, chart, lociNames, pv, ci, confLines, locusFst, isDominant, fdr): JDialog(frame) self.chart = chart self.frame = frame self.confLines = confLines self.isDominant = isDominant self.fdr = fdr pane = self.getRootPane().getContentPane() pane.setLayout(BorderLayout()) self.initTable(lociNames, pv, ci, locusFst) scrollPane = JScrollPane(self.table) osName = System.getProperty('os.name').lower() if not System.getProperty('java.specification.version')[-1] == '5': self.table.setFillsViewportHeight(True) pane.add(scrollPane, BorderLayout.CENTER) buttonPane = JPanel() sll = JButton('Save loci list') sll.addActionListener(self) sll.setActionCommand('SLL') buttonPane.add(sll) sci = JButton('Save confidence intervals') sci.addActionListener(self) sci.setActionCommand('SCI') buttonPane.add(sci) close = JButton('Close') close.addActionListener(self) close.setActionCommand('Close') buttonPane.add(close) pane.add(buttonPane, BorderLayout.PAGE_END) self.pack()
def show_detectable_objects_dialog(self, e): parentComponent = SwingUtilities.windowForComponent(self.panel0) self.detectable_obejcts_dialog = JDialog( parentComponent, "List of Objects to Detect", ModalityType.APPLICATION_MODAL) panel = JPanel() self.detectable_obejcts_dialog.add(panel) gbPanel = GridBagLayout() gbcPanel = GridBagConstraints() panel.setLayout(gbPanel) y = 0 x = 0 for line in self.local_settings.getClassesOfInterest(): if y > 15: y = 0 x = x + 1 class_check_box = JCheckBox(line['name']) self.classes_of_interest_checkboxes.append(class_check_box) class_check_box.setEnabled(True) class_check_box.setSelected(line['enabled']) class_check_box.addItemListener(self.on_class_checkbox_clicked) gbcPanel.gridx = x gbcPanel.gridy = y gbcPanel.gridwidth = 1 gbcPanel.gridheight = 1 gbcPanel.fill = GridBagConstraints.BOTH gbcPanel.weightx = 1 gbcPanel.weighty = 1 gbcPanel.anchor = GridBagConstraints.NORTH gbPanel.setConstraints(class_check_box, gbcPanel) panel.add(class_check_box) y = y + 1 blank_1_L = JLabel(" ") blank_1_L.setEnabled(True) gbcPanel.gridx = 0 gbcPanel.gridy = y + 1 gbcPanel.gridwidth = 1 gbcPanel.gridheight = 1 gbcPanel.fill = GridBagConstraints.BOTH gbcPanel.weightx = 1 gbcPanel.weighty = 0 gbcPanel.anchor = GridBagConstraints.NORTH gbPanel.setConstraints(blank_1_L, gbcPanel) panel.add(blank_1_L) deselect_all_button = JButton("Deselect all") deselect_all_button.setEnabled(True) deselect_all_button.addActionListener(self.on_deselect_all_clicked) gbcPanel.gridx = 1 gbcPanel.gridy = y + 2 gbcPanel.gridwidth = 1 gbcPanel.gridheight = 1 gbcPanel.fill = GridBagConstraints.BOTH gbcPanel.weightx = 2 gbcPanel.weighty = 1 gbcPanel.anchor = GridBagConstraints.NORTH gbPanel.setConstraints(deselect_all_button, gbcPanel) panel.add(deselect_all_button) select_all_button = JButton("Select all") select_all_button.setEnabled(True) select_all_button.addActionListener(self.on_select_all_clicked) gbcPanel.gridx = 3 gbcPanel.gridy = y + 2 gbcPanel.gridwidth = 1 gbcPanel.gridheight = 1 gbcPanel.fill = GridBagConstraints.BOTH gbcPanel.weightx = 2 gbcPanel.weighty = 1 gbcPanel.anchor = GridBagConstraints.NORTH gbPanel.setConstraints(select_all_button, gbcPanel) panel.add(select_all_button) blank_2_L = JLabel(" ") blank_2_L.setEnabled(True) gbcPanel.gridx = 0 gbcPanel.gridy = y + 3 gbcPanel.gridwidth = 1 gbcPanel.gridheight = 1 gbcPanel.fill = GridBagConstraints.BOTH gbcPanel.weightx = 1 gbcPanel.weighty = 0 gbcPanel.anchor = GridBagConstraints.NORTH gbPanel.setConstraints(blank_2_L, gbcPanel) panel.add(blank_2_L) cancel_button = JButton("Cancel") cancel_button.setEnabled(True) cancel_button.addActionListener( self.on_cancel_classes_of_interest_click) gbcPanel.gridx = 1 gbcPanel.gridy = y + 4 gbcPanel.gridwidth = 1 gbcPanel.gridheight = 1 gbcPanel.fill = GridBagConstraints.BOTH gbcPanel.weightx = 2 gbcPanel.weighty = 1 gbcPanel.anchor = GridBagConstraints.NORTH gbPanel.setConstraints(cancel_button, gbcPanel) panel.add(cancel_button) save_button = JButton("Save") save_button.setEnabled(True) save_button.addActionListener(self.on_save_classes_of_interest_click) gbcPanel.gridx = 3 gbcPanel.gridy = y + 4 gbcPanel.gridwidth = 1 gbcPanel.gridheight = 1 gbcPanel.fill = GridBagConstraints.BOTH gbcPanel.weightx = 2 gbcPanel.weighty = 1 gbcPanel.anchor = GridBagConstraints.NORTH gbPanel.setConstraints(save_button, gbcPanel) panel.add(save_button) blank_3_L = JLabel(" ") blank_3_L.setEnabled(True) gbcPanel.gridx = 0 gbcPanel.gridy = y + 5 gbcPanel.gridwidth = 1 gbcPanel.gridheight = 1 gbcPanel.fill = GridBagConstraints.BOTH gbcPanel.weightx = 1 gbcPanel.weighty = 0 gbcPanel.anchor = GridBagConstraints.NORTH gbPanel.setConstraints(blank_3_L, gbcPanel) panel.add(blank_3_L) self.detectable_obejcts_dialog.pack() screenSize = Toolkit.getDefaultToolkit().getScreenSize() self.detectable_obejcts_dialog.setLocation( int((screenSize.getWidth() / 2) - (self.detectable_obejcts_dialog.getWidth() / 2)), int((screenSize.getHeight() / 2) - (self.detectable_obejcts_dialog.getHeight() / 2))) self.detectable_obejcts_dialog.setVisible(True)