def initComponents(self): dataModel = DefaultTableModel(self.regTableData, self.regCols) self.regTable = JTable(dataModel) scrollPaneReg = JScrollPane() scrollPaneReg.getViewport().setView((self.regTable)) self.regTab.add(scrollPaneReg) # self.logTabbedPane.addTab('Registred',self.regTab) self.logTabbedPane.insertTab("Registred", None, self.regTab, None, 0) dataModel = DefaultTableModel(self.parkTableData, self.parkCols) self.parkTable = JTable(dataModel) scrollPanePark = JScrollPane() scrollPanePark.getViewport().setView((self.parkTable)) self.parkedTab.add(scrollPanePark) # self.logTabbedPane.addTab('Parked',self.parkedTab) self.logTabbedPane.insertTab("Parked", None, self.parkedTab, None, 1) dataModel = DefaultTableModel(self.bypassTableData, self.bypassCol) self.bypassTable = JTable(dataModel) scrollPaneBypass = JScrollPane() scrollPaneBypass.getViewport().setView((self.bypassTable)) self.bypassTab.add(scrollPaneBypass) # self.logTabbedPane.addTab('Bypassed',self.bypassTab) self.logTabbedPane.insertTab("Bypassed", None, self.bypassTab, None, 2) self.add(self.logTabbedPane, BorderLayout.CENTER) innerBorder = BorderFactory.createTitledBorder('View Logs ') outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5) self.setBorder( BorderFactory.createCompoundBorder(outerBorder, innerBorder))
def __init__(self, cattr): self.attr = cattr self.cbox = JColorChooser(self.attr.color) self.sym_panel = EditSymbolAttr(cattr.sym_prop) self.thickness_field = JTextField(str(cattr.thickness),2) self.draw_symbol_box = JCheckBox("Draw Symbol?",cattr.draw_symbol) self.dps_field = JTextField(str(self.attr.data_per_symbol),2) self.dash_box = JComboBox(CurveProps.DASH_TYPES.keys()) self.dash_box.setSelectedItem(self.attr.dash_type) self.dash_box.setBorder(BorderFactory.createTitledBorder("Dash type: (Only JDK2 & Slow!)")) tpanelx = JPanel() tpanelx.add(self.thickness_field) tpanelx.setBorder(BorderFactory.createTitledBorder("curve thickness (integer)")) tpanely = JPanel() tpanely.add(self.dps_field) tpanely.setBorder(BorderFactory.createTitledBorder("data per symbol(integer)")) tpanel = JPanel();tpanel.setLayout(GridLayout(2,2)); tpanel.add(self.draw_symbol_box); tpanel.add(tpanelx); tpanel.add(tpanely); tpanel.add(self.dash_box); panel1 = JPanel() panel1.setLayout(BorderLayout()) panel1.add(self.cbox,BorderLayout.CENTER) panel1.add(tpanel, BorderLayout.SOUTH) panel2 = JPanel() panel2.setLayout(BorderLayout()) panel2.add(self.sym_panel,BorderLayout.CENTER) tp1 = JTabbedPane() tp1.addTab("Curve Attributes",panel1) tp1.addTab("Symbol Attributes",panel2) tp1.setSelectedComponent(panel1) self.setLayout(BorderLayout()) self.add(tp1,BorderLayout.CENTER)
def __init__(self, window, checks_disabled, runcode): InputPane.__init__(self, window) outside = BorderFactory.createLoweredBevelBorder() self.component.border = BorderFactory.createCompoundBorder( outside, self.component.border ) self.checks_disabled = checks_disabled self.runcode = runcode
def warn(self, e): errorNumber = self.textfield.getText() if errorNumber == "": self.textfield.setBorder(self.defaultborder) return try: Integer.parseInt(errorNumber) except NumberFormatException: self.textfield.setBorder(BorderFactory.createLineBorder(Color.RED, 1)) return self.textfield.setBorder(BorderFactory.createLineBorder(Color.GREEN, 1))
def initComponents(self): self.setLayout(GridBagLayout()) gc = GridBagConstraints() gc.weightx = 1 gc.weighty = 1 # First Row gc.gridy = 0 gc.weightx = 1 gc.weighty = 0.1 gc.gridx = 0 gc.fill = GridBagConstraints.NONE gc.anchor = GridBagConstraints.LINE_END gc.insets = Insets(0, 0, 0, 5) self.add(self.usernameLabel, gc) gc.gridx = 1 gc.anchor = GridBagConstraints.LINE_START gc.insets = Insets(0, 0, 0, 0) self.add(self.usernameField, gc) # Second Row gc.gridy += 1 gc.weightx = 1 gc.weighty = 0.1 gc.gridx = 0 gc.anchor = GridBagConstraints.LINE_END gc.insets = Insets(0, 0, 0, 5) self.add(self.superPassLabel, gc) gc.gridx = 1 gc.anchor = GridBagConstraints.LINE_START gc.insets = Insets(0, 0, 0, 0) self.add(self.superPassField, gc) #Next Row gc.gridy += 1 gc.weightx = 1 gc.weighty = 2.0 gc.gridx = 1 gc.anchor = GridBagConstraints.FIRST_LINE_START self.add(self.deleteAdminBtn, gc) innerBorder = BorderFactory.createTitledBorder('Delete Admin') outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5) self.setBorder( BorderFactory.createCompoundBorder(outerBorder, innerBorder))
def warn(self, e): errorNumber = self.textfield.getText() if errorNumber == "": self.textfield.setBorder(self.defaultborder) return try: Integer.parseInt(errorNumber) except NumberFormatException: self.textfield.setBorder( BorderFactory.createLineBorder(Color.RED, 1)) return self.textfield.setBorder(BorderFactory.createLineBorder( Color.GREEN, 1))
def __init__(self): UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); size = Dimension(800, 800) self.setPreferredSize(size) screenSize = Toolkit.getDefaultToolkit().getScreenSize(); self.setLocation(screenSize.getSize().width/2 - size.width/2, 100) self.setTitle("bashED Terminal HQ EXTREME"); self.setUndecorated(True) self.getRootPane().setOpaque(False) #self.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); self.setBackground(Color(0,128,0, 198)) #j = JDesktopPane() #j.setOpaque(False) self.setLayout(None) self.setIconImage(ImageIcon('bin/gui/media/' + "icon.png").getImage()) mp = MainPanel() self.add(mp) mp.setBounds(0, 0, size.width, size.height) imageTest = ImageIcon('bin/gui/media/' + "image.png") imageTestLabel = JLabel(imageTest) self.add(imageTestLabel) imageTestLabel.setBounds(0, 0, size.width, size.height) #self.getContentPane().add(mp) #self.getContentPane().add(JLabel("Iglo")) bb = BorderFactory.createLineBorder(Color.BLACK, 5) bw1 = BorderFactory.createLineBorder(Color.WHITE, 1) bw2 = BorderFactory.createLineBorder(Color.WHITE, 1) mp.setBorder( BorderFactory.createCompoundBorder( bw1, BorderFactory.createCompoundBorder(bb, bw2) )) #make the window viewable self.defaultCloseOperation=JFrame.EXIT_ON_CLOSE self.pack() self.setVisible(True)
def add_template(self,name,constructor,image): icon = ImageIcon(image) if icon.iconWidth>self.max_icon_width: icon = ImageIcon(icon.image.getScaledInstance(self.max_icon_width,icon.iconHeight*self.max_icon_width/icon.iconWidth,Image.SCALE_SMOOTH)) panel = JPanel(layout = BorderLayout(),opaque = False) button = JButton(icon = icon,toolTipText = name.replace('\n',' '), borderPainted = False,focusPainted = False,contentAreaFilled = False,margin = java.awt.Insets(0,0,0,0), verticalTextPosition = AbstractButton.BOTTOM,horizontalTextPosition = AbstractButton.CENTER, mousePressed = lambda e: e.source.transferHandler.exportAsDrag(e.source,e,TransferHandler.COPY)) button.transferHandler = self panel.add(button) text = '<html><center>%s</center></html>'%name.replace('\n','<br/>') label = JLabel(text,horizontalAlignment = SwingConstants.CENTER,foreground = Color.WHITE) self.labels.append(label) panel.add(label,BorderLayout.SOUTH) self.panels.append(panel) panel.alignmentY = Component.CENTER_ALIGNMENT panel.border = BorderFactory.createEmptyBorder(2,1,2,1) panel.maximumSize = panel.preferredSize self.panel.add(panel) self.templates[button] = constructor
def __init__(self): FormPanel.__init__( self, gvsig.getResource(__file__, "sentinelSearchPanel.xml")) #self.setPreferredSize(300,700) self.params = None self.mapControl = None self.start = 0 self.rows = 10 self.sortby = "ingestiondate%20asc" # Init components self.lblPreview.setBorder(BorderFactory.createEmptyBorder()) platformOptions = ["---", "Sentinel-1", "Sentinel-2", "Sentinel-3"] for k in platformOptions: self.cmbPlatform.addItem(k) polarisation = ["---", "HH", "VV", "HV", "VH", "HH HV", "VV VH"] for k in polarisation: self.cmbPolarisation.addItem(k) sensors = ["---", "SM", "IW", "EW", "WV"] for k in sensors: self.cmbSensor.addItem(k) model1 = SpinnerNumberModel(5.0, 0.0, 100.0, 1.0) #spin1 = JSpinner(model1) self.spnCloud.setModel(model1) self.txtInfo.setCaretPosition(0) ## Download manager self.downloadManager = SentinelDownloadManager(self)
def __init__(self, controller): ''' Creates default empty console-looking panel. It should be separated from the rest of the GUI so that users can choose to show or hide the console. Or should it be a split panel? This panel will display log and validation/lemmatization messages. It might need its own toolbar for searching, etc. It will also accept commands in later stages of development, if need be. ''' #Give reference to controller to delegate action response self.controller = controller #Make text area occupy all available space and resize with parent window self.setLayout(BorderLayout()) #Create console-looking area self.editArea = JTextArea() self.editArea.border = BorderFactory.createEmptyBorder(4,4,4,4) self.editArea.font = Font("Courier New", Font.BOLD, 14) self.editArea.background = Color.BLACK self.editArea.foreground = Color.WHITE self.editArea.text = "Console started. Nammu's log will appear here.\n\n" #Will need scrolling controls scrollingText = JScrollPane(self.editArea) scrollingText.setPreferredSize(Dimension(1,150)) #Make text area auto scroll down to last printed line caret = self.editArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); #Add to parent panel self.add(scrollingText, BorderLayout.CENTER)
def render(self): '''Render on the frame the login panel with the fields needed to authenticate with the Asterisk manager.''' self.layout = GridLayout(0,2) self.setBorder(BorderFactory.createTitledBorder('Asterisk account information')) self.hostname = EnhancedTextField('localhost', 15) self.add(JLabel('Hostname:')) self.add(self.hostname) self.username = EnhancedTextField('manager', 15) self.add(JLabel('Username:'******'pa55word', 15) self.add(JLabel('Password:'******'SIP/John', 15) self.add(JLabel('Extension:')) self.add(self.extension) self.login = JButton('Log in', actionPerformed=self.buttonAction) self.add(self.login) self.status = JLabel('Awaiting information...') self.add(self.status)
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("All Logs", actionPerformed=self.checkBoxEvent) self.checkbox1 = JCheckBox("Application.Evtx", actionPerformed=self.checkBoxEvent) self.checkbox2 = JCheckBox("Security.EVTX", actionPerformed=self.checkBoxEvent) self.checkbox3 = JCheckBox("System.EVTX", actionPerformed=self.checkBoxEvent) self.checkbox4 = JCheckBox( "Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent) self.panel1.add(self.checkbox) self.panel1.add(self.checkbox1) self.panel1.add(self.checkbox2) self.panel1.add(self.checkbox3) self.panel1.add(self.checkbox4) self.add(self.panel1) self.area = JTextArea(5, 25) #self.area.addKeyListener(self) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self) #self.add(self.area) self.add(self.pane)
def initResultados(self): diag = JFrame() self.lineas = list() self.areaResultados = JTextArea() numLineas = self.readResultados() panelResultados = JPanel() #panelResultados.setAutoscrolls(True) panelResultados.setBorder(BorderFactory.createEtchedBorder()) panelResultados.setLayout(GridLayout(0, 1)) pane = JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) pane.viewport.view = self.areaResultados #pane.getViewport().add(panelResultados) diag.setTitle("RESULTADOS OBTENIDOS") diag.setSize(1000, 450) diag.setLayout(BorderLayout()) diag.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) diag.setLocationRelativeTo(None) diag.setVisible(True) panelResultados.add(pane) diag.add(panelResultados, BorderLayout.CENTER)
def __init__(self): self.setBorder(BorderFactory.createTitledBorder( "Setup a session handling action to" + " remove named cookies from Burp's" + " cookie jar")) self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) self._rowpanel1 = PTListPanel("Cookies to remove", []) self._rowpanel2 = JPanel() self._rowpanel2.setLayout(BoxLayout(self._rowpanel2, BoxLayout.X_AXIS)) self._button_update = JButton( "Add a new \"Remove cookies\" session handler" " for these cookies", actionPerformed=self._button_update_pressed ) self._rowpanel2.add(Box.createHorizontalGlue()) self._rowpanel2.add(self._button_update) self.add(self._rowpanel1) self.add(self._rowpanel2)
def run(self): self.size = (200, 400) self.contentPane.layout = awt.BorderLayout() line = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED) Panel1=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER)) Panel1.setBorder(line) label=swing.JLabel("") label.setText("Liste des numeros de boites") Panel1.add(label) Panel2=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER)) Panel2.setBorder(line) self.__displistnumb = swing.JList(self.__listnumb) Panel2.add(self.__displistnumb) barre = swing.JScrollPane(self.__displistnumb) Panel2.add(barre) Panel3=swing.JPanel(awt.FlowLayout(awt.FlowLayout.RIGHT)) Panel3.setBorder(line) select = swing.JButton("Select", actionPerformed=self.__select) Panel3.add(select) close = swing.JButton("Close", size=(100, 70), actionPerformed=self.__close) Panel3.add(close) self.contentPane.add(Panel1, awt.BorderLayout.NORTH) self.contentPane.add(Panel2, awt.BorderLayout.CENTER) self.contentPane.add(Panel3, awt.BorderLayout.SOUTH)
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("All Logs", actionPerformed=self.checkBoxEvent) self.checkbox1 = JCheckBox("Application.Evtx", actionPerformed=self.checkBoxEvent) self.checkbox2 = JCheckBox("Security.EVTX", actionPerformed=self.checkBoxEvent) self.checkbox3 = JCheckBox("System.EVTX", actionPerformed=self.checkBoxEvent) self.checkbox4 = JCheckBox("Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent) self.panel1.add(self.checkbox) self.panel1.add(self.checkbox1) self.panel1.add(self.checkbox2) self.panel1.add(self.checkbox3) self.panel1.add(self.checkbox4) self.add(self.panel1) self.area = JTextArea(5,25) #self.area.addKeyListener(self) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self) #self.add(self.area) self.add(self.pane)
def __init__(self): self.setBorder( BorderFactory.createTitledBorder( "Registered session handling actions" ) ) self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) self._rowpanel1 = JPanel() self._rowpanel1.setLayout(BoxLayout(self._rowpanel1, BoxLayout.X_AXIS)) self.listModel = DefaultListModel() self.List = JList(self.listModel) self.List.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ) self.List.setSelectedIndex(0) self.List.setVisibleRowCount(5) self.ScrollPane = JScrollPane(self.List) self.remove_button = JButton( "De-register selected", actionPerformed=self.button_remove_pressed ) self._rowpanel1.add(self.ScrollPane) self._rowpanel1.add(self.remove_button) self.add(self._rowpanel1)
def __init__(self): """ Line numbers need to be displayed in a separate panel with different styling. """ # Align right para_attribs = SimpleAttributeSet() StyleConstants.setAlignment(para_attribs, StyleConstants.ALIGN_RIGHT) self.setParagraphAttributes(para_attribs, True) # Use default font style default_attribs = SimpleAttributeSet() self.font = set_font() StyleConstants.setFontFamily(default_attribs, self.font.getFamily()) StyleConstants.setFontSize(default_attribs, self.font.getSize()) StyleConstants.setForeground(default_attribs, Color.gray) self.setCharacterAttributes(default_attribs, True) # Initialize content border = BorderFactory.createEmptyBorder(4, 4, 4, 4) self.border = border self.setText("1: \n") self.setEditable(False) # Prevent auto scroll down when line numbers are repainted caret = self.getCaret() caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE)
def __init__(self): self.frame = JFrame("Python Window") self.historyList = JList(DefaultListModel()) self.historyList.cellRenderer = MyListCellRenderer() #self.historyPanel.layout = BoxLayout( # self.historyPanel, # BoxLayout.Y_AXIS #) scrollpane = JScrollPane() # JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, # JScrollPane.HORIZONTAL_SCROLLBAR_NEVER #) # scrollpane.preferredSize = 400, 800 inputPanel = JPanel() inputPanel.layout = GridLayout(1, 1) self.input = JTextArea("") self.input.border = BorderFactory.createEmptyBorder(5, 5, 5, 5) self.input.tabSize = 4 self.input.font = Font("Monospaced", Font.PLAIN, 12) #self.input.preferredSize = 500, 200 self.input.addKeyListener(self) #self.button = JButton('Run', actionPerformed=self.run) inputPanel.add(self.input) #inputPanel.add(self.button) scrollpane.viewport.view = self.historyList self.frame.add(scrollpane, BorderLayout.CENTER) self.frame.add(inputPanel, BorderLayout.PAGE_END) self.frame.size = 500, 600 self.frame.visible = False
def __init__(self, parent, title, modal, app): JDialog.__init__(self, parent, title, modal) #Download and Read Dialog border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS)) panel = JPanel() panel.setAlignmentX(0.5) panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS)) panel.add(Box.createRigidArea(Dimension(0, 10))) self.progressLbl = JLabel( app.strings.getString("downloading_and_reading_errors")) panel.add(self.progressLbl) panel.add(Box.createRigidArea(Dimension(0, 10))) self.progressBar = JProgressBar(0, 100, value=0) panel.add(self.progressBar) self.add(panel) self.add(Box.createRigidArea(Dimension(0, 20))) cancelBtn = JButton(app.strings.getString("cancel"), ImageProvider.get("cancel"), actionPerformed=app.on_cancelBtn_clicked) cancelBtn.setAlignmentX(0.5) self.add(cancelBtn) self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) self.pack()
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Create Content View of Unique Event Id's", actionPerformed=self.checkBoxEvent) self.checkbox4 = JCheckBox("Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent) self.text1 = JLabel("*** Only run this once otherwise it adds it to the data again.") self.text2 = JLabel(" ") self.text3 = JLabel("*** Format is a comma delimited text ie: 8001, 8002") self.panel1.add(self.checkbox) self.panel1.add(self.text1) self.panel1.add(self.text2) self.panel1.add(self.checkbox4) self.panel1.add(self.text3) self.add(self.panel1) self.area = JTextArea(5,25) #self.area.addKeyListener(self) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self) #self.add(self.area) self.add(self.pane)
def run(self): self.size = (200, 300) self.contentPane.layout = awt.BorderLayout() line = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED) Panel1=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER)) Panel1.setBorder(line) label=swing.JLabel("") label.setText("Liste des noms de boites") Panel1.add(label) Panel2=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER)) Panel2.setBorder(line) self.__displistnomb = swing.JList(self.__listnomb) self.__displistnomb.setVisibleRowCount(14) Panel2.add(self.__displistnomb) barre = swing.JScrollPane(self.__displistnomb) Panel2.add(barre) Panel3=swing.JPanel(awt.FlowLayout(awt.FlowLayout.RIGHT)) Panel3.setBorder(line) self.contentPane.add(Panel1, awt.BorderLayout.NORTH) self.contentPane.add(Panel2, awt.BorderLayout.CENTER) self.contentPane.add(Panel3, awt.BorderLayout.SOUTH)
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Искать таблицы?".decode('UTF-8'), actionPerformed=self.checkBoxEvent) self.label0 = JLabel(" ") self.label1 = JLabel( "Введите названия интересуемых таблиц".decode('UTF-8')) self.label2 = JLabel( "через запятую, после чего установите флажок".decode('UTF-8')) self.label3 = JLabel(" ") self.panel1.add(self.checkbox) self.panel1.add(self.label0) self.panel1.add(self.label1) self.panel1.add(self.label2) self.panel1.add(self.label3) self.add(self.panel1) self.local_settings.setSetting('Flag', 'false') self.area = JTextArea(5, 25) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) self.add(self.pane)
def __init__(self, parent, title, modal, app): self.app = app self.setSize(400, 450) border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.setLayout(BorderLayout(5, 5)) #Intro introLbl = JLabel("<html>%s</html>" % self.app.strings.getString("error_info_intro")) #Panel for displaying error info self.infoPanel = HtmlPanel() self.infoPanel.getEditorPane().addHyperlinkListener(self) self.scrollPane = JScrollPane(self.infoPanel) #OK button btnPanel = JPanel(FlowLayout(FlowLayout.CENTER)) okBtn = JButton(self.app.strings.getString("OK"), ImageProvider.get("ok"), actionPerformed=self.on_okBtn_clicked) btnPanel.add(okBtn) #Layout self.add(introLbl, BorderLayout.PAGE_START) self.add(self.scrollPane, BorderLayout.CENTER) self.add(btnPanel, BorderLayout.PAGE_END) self.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE)
def __init__(self, cattrs): #JDialog.__init__(self,"Curve Attribute Editor") #("Curve Attribute Editor") if cattrs == None or len(cattrs) == 0: raise "No curve attributes specified" self.attrs = cattrs self.cpanel = EditCurveAttr(cattrs[0]) pane = self.getContentPane() pane.setLayout(BorderLayout()) x = map(lambda x: x+1,range(len(self.attrs))) self.curveBox = JComboBox(x) self.curveBox.setBorder(BorderFactory.createTitledBorder("Curve #")) self.curveBox.setSelectedItem(0) class CListener(ItemListener): def __init__(self,cbox,cpanel,cattrs): self.cbox = cbox self.cpanel = cpanel self.attrs = cattrs def itemStateChanged(self, evt): crvNo = self.cbox.getSelectedItem() self.cpanel.update() self.cpanel.setAttribute(self.attrs[crvNo-1]) self.curveBox.addItemListener(CListener(self.curveBox, self.cpanel,self.attrs)) okBtn = JButton("OK",actionPerformed=self.ok_action) cancelBtn = JButton("Cancel",actionPerformed=self.cancel_action) btnPanel = JPanel() btnPanel.setLayout(GridLayout(1,3)) btnPanel.add(self.curveBox) btnPanel.add(okBtn) btnPanel.add(cancelBtn) pane.add(self.cpanel,BorderLayout.CENTER) pane.add(btnPanel, BorderLayout.SOUTH) self.setLocation(100,100) self.pack() self.setVisible(1)
def actionPerformed(self, e): bugs_tab = self.tabbed_panes[self.key].getComponentAt(1) tab_count = str(bugs_tab.getTabCount()) request_tab = self.view.set_request_tab_pane(self.request_response) response_tab = self.view.set_response_tab_pane(self.request_response) bugs_tabbed_pane = self.view.set_bugs_tabbed_pane(request_tab, response_tab) bugs_tab.add(tab_count, bugs_tabbed_pane) index = bugs_tab.indexOfTab(tab_count) panel_tab = JPanel(GridBagLayout()) panel_tab.setOpaque(False) label_title = JLabel(tab_count) # Create a button to close tab button_close = JButton("x") button_close.setToolTipText("Close tab") button_close.setOpaque(False); button_close.setContentAreaFilled(False); button_close.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) button_close.setPreferredSize(Dimension(18, 18)) button_close.setMargin(Insets(0, 0, 0, 0)) button_close.setForeground(Color.gray) panel_tab.add(label_title) panel_tab.add(button_close) bugs_tab.setTabComponentAt(index, panel_tab) button_close.addMouseListener(CloseTab(button_close, bugs_tab))
def run(self): self.size = (800, 400) self.contentPane.layout = awt.BorderLayout() line = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED) Panel1=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER)) Panel1.setBorder(line) label=swing.JLabel("") label.setText("Liste des Images") Panel1.add(label) Panel2=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER)) Panel2.setBorder(line) listtitles=[imp.getTitle() for imp in self.__listimp] self.__listimages = swing.JList(listtitles) self.__listimages.setFixedCellWidth(736) self.__listimages.setVisibleRowCount(30) barre = swing.JScrollPane(self.__listimages) Panel2.add(barre) Panel3=swing.JPanel(awt.FlowLayout(awt.FlowLayout.RIGHT)) Panel3.setBorder(line) select = swing.JButton("Show Selected", actionPerformed=self.__select) Panel3.add(select) hide = swing.JButton("Hide Selected", size=(100, 70), actionPerformed=self.__hide) Panel3.add(hide) closeall = swing.JButton("Close All images", size=(100, 70), actionPerformed=self.__closeall) Panel3.add(closeall) self.contentPane.add(Panel1, awt.BorderLayout.NORTH) self.contentPane.add(Panel2, awt.BorderLayout.CENTER) self.contentPane.add(Panel3, awt.BorderLayout.SOUTH)
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Check to activate/deactivate TextArea", actionPerformed=self.checkBoxEvent) self.label0 = JLabel(" ") self.label1 = JLabel("Input in SQLite DB's in area below,") self.label2 = JLabel("seperate values by commas.") self.label3 = JLabel("then check the box above.") self.label4 = JLabel(" ") self.panel1.add(self.checkbox) self.panel1.add(self.label0) self.panel1.add(self.label1) self.panel1.add(self.label2) self.panel1.add(self.label3) self.panel1.add(self.label4) self.add(self.panel1) self.area = JTextArea(5, 25) #self.area.getDocument().addDocumentListener(self.area) #self.area.addKeyListener(listener) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self.area) #self.add(self.area) self.add(self.pane)
def __init__(self, parent, title, modal, app): JDialog.__init__(self, parent, title, modal) #Download and Read Dialog border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS)) panel = JPanel() panel.setAlignmentX(0.5) panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS)) panel.add(Box.createRigidArea(Dimension(0, 10))) self.progressLbl = JLabel(app.strings.getString("downloading_and_reading_errors")) panel.add(self.progressLbl) panel.add(Box.createRigidArea(Dimension(0, 10))) self.progressBar = JProgressBar(0, 100, value=0) panel.add(self.progressBar) self.add(panel) self.add(Box.createRigidArea(Dimension(0, 20))) cancelBtn = JButton(app.strings.getString("cancel"), ImageProvider.get("cancel"), actionPerformed=app.on_cancelBtn_clicked) cancelBtn.setAlignmentX(0.5) self.add(cancelBtn) self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) self.pack()
def run(self): self.size = (200, 600) self.contentPane.layout = awt.BorderLayout() line = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED) Panel1=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER)) Panel1.setBorder(line) label=swing.JLabel("") label.setText("Liste des Puits") Panel1.add(label) menu = swing.JMenuBar() Panel1.add(menu) Panel2=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER)) Panel2.setBorder(line) self.__displistwell = swing.JList(self.__listwell) self.__displistwell.setVisibleRowCount(28) self.__displistwell.setFixedCellWidth(150) Panel2.add(self.__displistwell) barre = swing.JScrollPane(self.__displistwell) Panel2.add(barre) Panel3=swing.JPanel(awt.FlowLayout(awt.FlowLayout.RIGHT)) Panel3.setBorder(line) select = swing.JButton("Select", actionPerformed=self.__select) Panel3.add(select) close = swing.JButton("Close", size=(100, 70), actionPerformed=self.__close) Panel3.add(close) self.contentPane.add(Panel1, awt.BorderLayout.NORTH) self.contentPane.add(Panel2, awt.BorderLayout.CENTER) self.contentPane.add(Panel3, awt.BorderLayout.SOUTH)
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Check to activate/deactivate TextArea", actionPerformed=self.checkBoxEvent) self.label0 = JLabel(" ") self.label1 = JLabel("Input in SQLite DB's in area below,") self.label2 = JLabel("seperate values by commas.") self.label3 = JLabel("then check the box above.") self.label4 = JLabel(" ") self.panel1.add(self.checkbox) self.panel1.add(self.label0) self.panel1.add(self.label1) self.panel1.add(self.label2) self.panel1.add(self.label3) self.panel1.add(self.label4) self.add(self.panel1) self.area = JTextArea(5,25) #self.area.getDocument().addDocumentListener(self.area) #self.area.addKeyListener(listener) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self.area) #self.add(self.area) self.add(self.pane)
def __init__(self): """ Line numbers need to be displayed in a separate panel with different styling. """ # Align right para_attribs = SimpleAttributeSet() StyleConstants.setAlignment(para_attribs, StyleConstants.ALIGN_RIGHT) self.setParagraphAttributes(para_attribs, True) # Use default font style default_attribs = SimpleAttributeSet() StyleConstants.setFontFamily(default_attribs, "Monaco") StyleConstants.setFontSize(default_attribs, 14) StyleConstants.setForeground(default_attribs, Color.gray) self.setCharacterAttributes(default_attribs, True) # Initialize content border = BorderFactory.createEmptyBorder(4, 4, 4, 4) self.border = border self.setText("1: \n") self.setEditable(False) # Prevent auto scroll down when line numbers are repainted caret = self.getCaret() caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE)
def run(self): self.size = (200,300) self.contentPane.layout = awt.BorderLayout() line = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED) Panel1=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER)) Panel1.setBorder(line) label=swing.JLabel("") label.setText("Liste des Genes") Panel1.add(label) menu = swing.JMenuBar() Panel1.add(menu) Panel2=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER)) Panel2.setBorder(line) self.__displistgenes = swing.JList(self.__listgenes) self.__displistgenes.setVisibleRowCount(14) self.__displistgenes.setFixedCellWidth(75) Panel2.add(self.__displistgenes) barre = swing.JScrollPane(self.__displistgenes) Panel2.add(barre) Panel3=swing.JPanel(awt.FlowLayout(awt.FlowLayout.RIGHT)) Panel3.setBorder(line) self.contentPane.add(Panel1, awt.BorderLayout.NORTH) self.contentPane.add(Panel2, awt.BorderLayout.CENTER) self.contentPane.add(Panel3, awt.BorderLayout.SOUTH)
def createEditorComponent(self, properties): p = JPanel(GridBagLayout()) p.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)) gbc = GridBagConstraints() gbc.gridx = 0 gbc.gridy = 0 gbc.weightx = 0.0 gbc.weighty = 0.0 gbc.fill = GridBagConstraints.HORIZONTAL gbc.insets = Insets(3, 3, 3, 3) p.add(JLabel("Prompt:"), gbc) gbc.gridx = 1 editor = NodePropertiesDialog.createTextArea(properties, self.PROMPT) p.add(editor, gbc) gbc.gridx, gbc.gridy = 1, 0 p.add( NodePropertiesDialog.createCheckBox(properties, self.WAIT, "Wait until done"), gbc) jtp = JTabbedPane() jtp.addTab("Output", p) return jtp
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Create Content View of Unique Event Id's", actionPerformed=self.checkBoxEvent) self.checkbox4 = JCheckBox( "Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent) self.text1 = JLabel( "*** Only run this once otherwise it adds it to the data again.") self.text2 = JLabel(" ") self.text3 = JLabel( "*** Format is a comma delimited text ie: 8001, 8002") self.panel1.add(self.checkbox) self.panel1.add(self.text1) self.panel1.add(self.text2) self.panel1.add(self.checkbox4) self.panel1.add(self.text3) self.add(self.panel1) self.area = JTextArea(5, 25) #self.area.addKeyListener(self) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self) #self.add(self.area) self.add(self.pane)
def __init__(self, controller): ''' Creates default empty text area in a panel. It will contain the ATF file content, and allow text edition. It should highlight reserved words and suggest autocompletion or possible typos, a la IDEs like Eclipse. It might need refactoring so that there is a parent panel with two modes or contexts, depending on user choice: text view or model view. ''' #Give reference to controller to delegate action response self.controller = controller #Make text area occupy all available space and resize with parent window self.setLayout(BorderLayout()) #Create text edition area self.editArea = JTextArea() self.editArea.border = BorderFactory.createEmptyBorder(4,4,4,4) self.editArea.font = Font("Monaco", Font.PLAIN, 14) #Will need scrolling controls scrollingText = JScrollPane(self.editArea) scrollingText.setPreferredSize(Dimension(1,500)) #Add to parent panel self.add(scrollingText, BorderLayout.CENTER)
def common_label(display, image_file, i, j, value, colorizer): return JLabel(display, image_file or None, JLabel.CENTER, border=BorderFactory.createLineBorder(Color.black), toolTipText=make_position(i, j), opaque=True, background=colorizer(value, i, j))
def __init__(self): UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) size = Dimension(800, 800) self.setPreferredSize(size) screenSize = Toolkit.getDefaultToolkit().getScreenSize() self.setLocation(screenSize.getSize().width / 2 - size.width / 2, 100) self.setTitle("bashED Terminal HQ EXTREME") self.setUndecorated(True) self.getRootPane().setOpaque(False) #self.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); self.setBackground(Color(0, 128, 0, 198)) #j = JDesktopPane() #j.setOpaque(False) self.setLayout(None) self.setIconImage(ImageIcon('bin/gui/media/' + "icon.png").getImage()) mp = MainPanel() self.add(mp) mp.setBounds(0, 0, size.width, size.height) imageTest = ImageIcon('bin/gui/media/' + "image.png") imageTestLabel = JLabel(imageTest) self.add(imageTestLabel) imageTestLabel.setBounds(0, 0, size.width, size.height) #self.getContentPane().add(mp) #self.getContentPane().add(JLabel("Iglo")) bb = BorderFactory.createLineBorder(Color.BLACK, 5) bw1 = BorderFactory.createLineBorder(Color.WHITE, 1) bw2 = BorderFactory.createLineBorder(Color.WHITE, 1) mp.setBorder( BorderFactory.createCompoundBorder( bw1, BorderFactory.createCompoundBorder(bb, bw2))) #make the window viewable self.defaultCloseOperation = JFrame.EXIT_ON_CLOSE self.pack() self.setVisible(True)
def createColoredLabel(self, text, color): return JLabel(text, opaque=1, size=(150, 130), background=color, foreground=Color.black, verticalAlignment=JLabel.TOP, horizontalAlignment=JLabel.CENTER, border=BorderFactory.createLineBorder(Color.black))
def __init__(self, controller): self.controller = controller self.border = BorderFactory.createEmptyBorder(4, 4, 4, 4) self.font = set_font() # If this is not done, no tooltips appear self.setToolTipText("") # Consume mouse events when over this JTextPane listener = CustomMouseListener(self) self.addMouseListener(listener)
def __init__(self): self.setLayout( BoxLayout( self, BoxLayout.X_AXIS ) ) self.setBorder( BorderFactory.createEmptyBorder(5, 5, 5, 5) )
def __init__(self, crate, slot, parentCrate): JPanel.__init__(self) self.bag = GridBag(self) # vertical labels for y in range(len(self.board.spyShortNameList)): name = self.board.spyShortNameList[y] self.bag.add(JLabel(name), gridx=0, gridy=y) # spy monitors self.spyMonitorList = map( lambda x, parentCrate=parentCrate: spyMonitor(x, parentCrate), self.board.spyList) for i in range(self.board.spyNumber): self.bag.add(self.spyMonitorList[i], gridx=1, gridy=i) # set borders - this line is copied by an online Swing tutorial... self.border = BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("%s-%d" % (self.board.type, slot)), BorderFactory.createEmptyBorder(5, 5, 5, 5))
def __init__(self, controller): # This custom StyledEditorKit fixes broken line wrapping. self.setEditorKit(MyStyledEditorKit()) self.controller = controller self.border = BorderFactory.createEmptyBorder(4, 4, 4, 4) # If this is not done, no tooltips appear self.setToolTipText("") # Consume mouse events when over this JTextPane listener = CustomMouseListener(self) self.addMouseListener(listener)
def __init__(self, extender): # Initialize self super(MainPanel, self).__init__() self.extender = extender self.setLayout(BorderLayout()) self.setBorder(BorderFactory.createLineBorder(Color.BLACK)); # Create children self.tree = ResultTree(extender) # Add children self.add(JScrollPane(self.tree), BorderLayout.CENTER)
def initUI(self): global outputTextField self.panel = JPanel() self.panel.setLayout(BorderLayout()) toolbar = JToolBar() openb = JButton("Choose input file", actionPerformed=self.onClick) outputLabel = JLabel(" Enter output file name: ") outputTextField = JTextField("hl7OutputReport.txt", 5) print outputTextField.getText() toolbar.add(openb) toolbar.add(outputLabel) toolbar.add(outputTextField) self.area = JTextArea() self.area.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.area.setText("Select your HL7 ORU messages text file to be converted to tab-delimited flat \nfile with select HL7 fields.\n") self.area.append("You can enter the path + file name for your output file or it will default to the current \nfile name in the text field above in your current working directory.") pane = JScrollPane() pane.getViewport().add(self.area) self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.panel.add(pane) self.add(self.panel) self.add(toolbar, BorderLayout.NORTH) self.setTitle("HL7 ORU Results Reporter") self.setSize(600, 300) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True) return outputTextField.getText()
def initComponents(self): self.panel = JPanel() self.panel.setLayout(BorderLayout()) toolbar = JToolBar() openb = JButton("Select", actionPerformed=self.onClick) toolbar.add(openb) self.area = JTextArea() self.area.setBorder(BorderFactory.createEmptyBorder(10, 100, 10, 100)) pane = JScrollPane() pane.getViewport().add(self.area) self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.panel.add(pane) self.add(self.panel) self.add(toolbar)
def generateTextBox(defaultTxt, editable): sample = JTextArea(5, 20) scrollPane1 = JScrollPane(sample) sample.setBounds(0, 0, 400, 400) sample.setEditable(editable) sample.setLineWrap(True) sample.setWrapStyleWord(True) sample.setBorder(BorderFactory.createLineBorder(Color.BLACK)) sample.setText(defaultTxt) return sample
def renderMainPanel(self): '''Render on the frame the main panel with a status label''' self.mainPanel = JPanel(GridLayout(0,2)) self.frame.add(self.mainPanel) self.mainPanel.setBorder(BorderFactory.createTitledBorder('Application status')) self.mainPanel.add(JLabel('Status:')) self.statusLabel = JTextField('Running...', 15) self.statusLabel.editable = False self.mainPanel.add(self.statusLabel)
def __init__(self,view,name,values,default): self.view=view self.layout=BorderLayout() self.name=name self.values_data=values self.values=JList(values,border=BorderFactory.createLineBorder(Color.black,1), valueChanged=self.adjust) self.add(JLabel(name,horizontalAlignment=SwingConstants.LEFT),BorderLayout.NORTH) self.new_value=JTextField('',actionPerformed=self.create_new_value) self.add(self.new_value,BorderLayout.SOUTH) self.add(self.values) self.values.setSelectedValue(default,True)
def run(self): self.frame = frame = JFrame('ProgressMonitor', size=(280, 125), locationRelativeTo=None, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) frame.getContentPane().setBorder( BorderFactory.createEmptyBorder(20, 20, 20, 20)) panel = JPanel() self.button = panel.add(JButton('Start', actionPerformed=self.start)) frame.add(panel, BorderLayout.NORTH) frame.setVisible(1)
def buildConfigPane(self, state, callbacks): """ Builds the config pane, section per section. """ configPage = Box.createVerticalBox() configPage.setBorder(BorderFactory.createLineBorder(Color.black)) configPage.add(self.buildScope(state, callbacks)) configPage.add(self.buildReplacementRules(state, callbacks)) configPage.add(self.buildSessionCheck(state, callbacks)) return configPage
def __init__(self, frame, title): EnhancedDialog.__init__(self, frame, title, 1) self.contentPane.layout = layout(5, 5) upperPanel = panel(layout(5, 5)) topPanel = panel(layout(5, 20)) topPanel.add(label("Hahahaha", label.CENTER), layout.CENTER) topPanel.add( label( getIconFromPlugin("jython.JythonPlugin", "images/PythonIcon.gif"), label.CENTER), layout.EAST) upperPanel.add(topPanel, layout.NORTH) copy = JTextArea(copyright) upperPanel.border = BorderFactory.createTitledBorder("Hihihihi") copy.border = BorderFactory.createEmptyBorder(5, 5, 5, 5) upperPanel.add(copy, layout.SOUTH) self.contentPane.add(upperPanel, layout.CENTER) lowerPanel = panel() lowerPanel.add( button(getProperty("common.close"), actionPerformed=self._close)) self.contentPane.add(lowerPanel, layout.SOUTH) self.pack()
def __init__(self, sattr): self.attr = sattr self.cbox = JColorChooser(self.attr.color) self.sz_field = JTextField(str(self.attr.size)) szpanel = JPanel() szpanel.add(self.sz_field) szpanel.setBorder(BorderFactory.createTitledBorder("symbol size (integer)")) self.filled_box = JCheckBox("Filled ?:",self.attr.filled) self.shape_cbox = JComboBox(SymbolProps.sym_shape_map.keys()) self.shape_cbox.setSelectedItem(self.attr.shape) self.shape_cbox.setBorder(BorderFactory.createTitledBorder("Shape")) panel1 = JPanel() panel1.setLayout(BorderLayout()) panel1.add(szpanel,BorderLayout.NORTH) panel2 = JPanel() panel2.setLayout(GridLayout(1,2)) panel2.add(self.shape_cbox) panel2.add(self.filled_box) panel1.add(panel2,BorderLayout.SOUTH) self.setLayout(BorderLayout()) self.add(self.cbox,BorderLayout.CENTER) self.add(panel1,BorderLayout.SOUTH)
def __init__(self): self.dir_path = '' self.panel = JPanel() box_layout = BoxLayout(self.panel, BoxLayout.Y_AXIS) self.panel.setLayout(box_layout) self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.choose_dir_label = JLabel('Experiment Folder:') self.choose_dir_textField = JTextField(30) self.choose_dir_textField.addActionListener( ActionListenerFactory(self, self.textField_al)) self.choose_dir_button = JButton('open') self.choose_dir_button.addActionListener( ActionListenerFactory(self, self.choose_dir_al)) self.choose_dir_panel = JPanel() self.choose_dir_panel.add(self.choose_dir_label) self.choose_dir_panel.add(self.choose_dir_textField) self.choose_dir_panel.add(self.choose_dir_button) self.panel.add(self.choose_dir_panel) # root = DefaultMutableTreeNode() # self.meta_data_mode_label = JLabel('Autogenerated meta_data file mode') # self.raw_stack_mode = JRadioButton('raw stack mode') # self.projection_mode = JRadioButton('projection files mode') # # self.meta_data_mode = ButtonGroup() # self.meta_data_mode.add(self.raw_stack_mode) # self.meta_data_mode.add(self.projection_mode) # # self.meta_data_mode_panel = JPanel(GridLayout(0, 1)) # self.meta_data_mode_panel.add(self.meta_data_mode_label) # self.meta_data_mode_panel.add(self.raw_stack_mode) # self.meta_data_mode_panel.add(self.projection_mode) # # self.panel.add(self.meta_data_mode_panel) self.run_button = JButton('Run') self.run_button.addActionListener( ActionListenerFactory(self, self.run_button_al)) self.panel.add(self.run_button) super(BobGui, self).__init__("BobPy") self.getContentPane().add(self.panel) self.pack() self.setLocationRelativeTo(None) self.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE) self.setVisible(True)
def __init__(self, controller): ''' Creates default empty console-looking panel. It should be separated from the rest of the GUI so that users can choose to show or hide the console. Or should it be a split panel? This panel will display log and validation/lemmatization messages. It might need its own toolbar for searching, etc. It will also accept commands in later stages of development, if need be. ''' # Give reference to controller to delegate action response self.controller = controller # Make text area occupy all available space and resize with parent # window self.setLayout(BorderLayout()) # Create console-looking area self.edit_area = JEditorPane() # Although most of the styling is done using css, we need to set these # properties to ensure the html is rendered properly in the console self.edit_area.border = BorderFactory.createEmptyBorder(6, 6, 6, 6) self.edit_area.setContentType("text/html") # Disable writing in the console - required to render hyperlinks self.edit_area.setEditable(False) # Map CSS color strings to Java Color objects self.colors = {'Gray': Color(238, 238, 238), 'Black': Color(0, 0, 0), 'Yellow': Color(255, 255, 0)} # Initial call to refresh console to set the console style properties self.refreshConsole() # Set up a hyperlink listener listener = addEventListener(self.edit_area, HyperlinkListener, 'hyperlinkUpdate', self.handleEvent) # Will need scrolling controls scrollingText = JScrollPane(self.edit_area) scrollingText.setPreferredSize(Dimension(1, 150)) # Make text area auto scroll down to last printed line caret = self.edit_area.getCaret() caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE) # Add to parent panel self.add(scrollingText, BorderLayout.CENTER)
def __init__(self, gameplayer): FormPanel.__init__(self, os.path.join(os.path.dirname(__file__), "gameplayer.xml")) self.setPreferredSize(400, 175) self.pgbGame.setMaximum(len(gameplayer.getQuestions())) self.pgbGame.setValue(1) self.pgbGame.setString("1/" + str(len(gameplayer.getQuestions()))) self.pgbGame.setStringPainted(1) self.pnlQuestion.setLayout(BorderLayout()) self.pnlQuestion.setBorder(BorderFactory.createLineBorder(Color.lightGray, 1, 1)) self.index = 0 self.questionslist = gameplayer.getQuestions() self.viewslist = gameplayer.getViews() self.report = Report(gameplayer.getUserRole(), gameplayer.getUserId()) self.fillPanel(gameplayer.getQuestions()[0]) self.updateView(gameplayer.getViews()[0])
def createAuxPanelWrapper(self, auxPanel, auxTitle): # Initialize auxillary panel leftPanel = JPanel() leftPanel.layout = BorderLayout() leftPanel.addFocusListener(LeftFocusListener(self)) # NengoStyle.applyStyle(leftPanel); if self.showTitle: # Create auxillary panel's title bar titleBar = JPanel() titleBar.border = BorderFactory.createEmptyBorder(0, 0, 5, 0)) NengoStyle.applyStyle(titleBar) titleBar.background = NengoStyle.COLOR_BACKGROUND2 titleBar.opaque = True titleBar.layout = BorderLayout() titleLabel = JLabel(title) titleLabel.font = NengoStyle.FONT_BIG NengoStyle.applyStyle(titleLabel) titleLabel.background = NengoStyle.COLOR_BACKGROUND2 titleLabel.opaque = True hideButtonTxt = " >> " if self.orientation == 'right' else " << " hideButton = JLabel(hideButtonTxt) NengoStyle.applyStyle(hideButton) hideButton.background = NengoStyle.COLOR_BACKGROUND2 hideButton.opaque = True # Keep in this order, Swing puts items added first on top. # We want the button to be on top titleBar.add(hideButton, BorderLayout.EAST) titleBar.add(titleLabel, BorderLayout.WEST) hideButton.addMouseListener(HideButtonListener(self, hideButton)) leftPanel.add(titleBar, BorderLayout.NORTH) leftPanel.minimumSize = self.minimumSize if auxPanel is not None: # NengoStyle.applyStyle(auxPanel) leftPanel.add(auxPanel, BorderLayout.CENTER) return leftPanel