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
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, window, api): self.api = api self.component = JPanel(BorderLayout()) scrollpane = JScrollPane() inputPanel = JPanel() inputPanel.layout = GridLayout(1, 1) self.check_disabled = LockManager() self.input = InteractiveInput( window, self.check_disabled, self.runcode ) self.input.undo = UndoManager() self.input.component.document.addDocumentListener(self) inputPanel.add(self.input.component) self.outputpane = OutputPane() scrollpane.viewport.view = self.outputpane.textpane self.component.add(scrollpane, BorderLayout.CENTER) self.component.add(inputPanel, BorderLayout.PAGE_END) self.history = InputHistory() self.stdout = MyStream(self.write) self.stderr = MyStream(self.error) self.running_thread = None
def addButtons(self, container): pane = JPanel() pane.layout = BoxLayout(pane, BoxLayout.Y_AXIS) pane.add(JButton("Alliance", actionPerformed=self.clickAlliance)) pane.add(JButton("Enemy", actionPerformed=self.clickEnemy)) pane.add(JButton("None", actionPerformed=self.noMode)) pane.add(JButton("CheckPos", actionPerformed=self.checkPos)) pane.add(JButton("GetMousePos", actionPerformed=self.getCurrentPos)) pane.add(JButton("Exit", actionPerformed=self.stop)) container.add(pane)
def addButtons(self, container): pane = JPanel() pane.layout = BoxLayout(pane, BoxLayout.Y_AXIS) pane.add(JButton(u"R1", actionPerformed = self.task1)) pane.add(JButton(u"R2", actionPerformed = self.task2)) pane.add(JButton(u"R3", actionPerformed = self.task3)) pane.add(JButton(u"R4", actionPerformed = self.task4)) pane.add(JButton(u"R5", actionPerformed = self.task5)) pane.add(JButton(u"2 Items", actionPerformed = self.taskAA2)) pane.add(JButton(u"3 Items", actionPerformed = self.taskAA3)) pane.add(JButton(u"開拓", actionPerformed = self.taskA3)) pane.add(JButton(u"Stop", actionPerformed = self.stop)) pane.add(JButton(u"Exit", actionPerformed = self.quit)) container.add(pane)
def run(): eventbus = EventBus() canvas_model = CanvasModel(eventbus) canvas_model.elems = [Ellipse(20, 30, 40, 50), Rectangle(30, 40, 10, 20)] eventbus.register(Undo_Requested, lambda _: canvas_model.undo()) eventbus.register(Redo_Requested, lambda _: canvas_model.redo()) cvs_view_1, cvs_states_1, cvs_trans_1 = widgets.canvas.make(eventbus, canvas_model) cvs_view_2, cvs_states_2, cvs_trans_2 = widgets.canvas.make(eventbus, canvas_model) app_states = { 'top': { 'canvas_displayed': State([ (cvs_states_1, cvs_trans_1), (cvs_states_2, cvs_trans_2), #(toolbar_states, toolbar_trans), ]), } } app_trans = { 'top': { Initial: T('canvas_displayed'), } } hsm = HSM(app_states, app_trans) hsm.start(eventbus) app_frame = AppFrame(eventbus) canvases = JPanel() canvases.layout = BoxLayout(canvases, BoxLayout.PAGE_AXIS) canvases.add(cvs_view_1) canvases.add(cvs_view_2) app_frame.add(canvases, BorderLayout.CENTER) cvs_view_2.background = Color.GRAY app_frame.size = (1100, 1000)
def __init__(self,options): self.options=options self.layout=BoxLayout(self,BoxLayout.Y_AXIS) self.area=JCheckBox('CI area',False,actionPerformed=self.options.changed) self.add(self.area) self.x_axis=JComboBox(['equal','linear','log'],editable=False) self.x_axis.selectedIndex=0 self.x_axis.addActionListener(self) self.y_axis=JComboBox(['linear','log'],editable=False) self.y_axis.selectedIndex=0 self.y_axis.addActionListener(self) axis=JPanel(border=BorderFactory.createTitledBorder('axis')) axis.layout=BoxLayout(axis,BoxLayout.X_AXIS) axis.add(JLabel('x:')) axis.add(self.x_axis) axis.add(JLabel('y:')) axis.add(self.y_axis) axis.maximumSize=axis.minimumSize self.add(axis)
def __init__(self): self.frame = JFrame("Python Window") #self.historyList = JList(DefaultListModel()) #self.historyList.cellRenderer = MyListCellRenderer() scrollpane = JScrollPane() 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.addKeyListener(self) inputPanel.add(self.input) self.outputpane = OutputPane() scrollpane.viewport.view = self.outputpane.textpane #self.historyList self.frame.add(scrollpane, BorderLayout.CENTER) self.frame.add(inputPanel, BorderLayout.PAGE_END) self.frame.size = 500, 600 self.frame.visible = False self.component = None
def __init__(self, interface): self.interface = interface self.frame = JFrame("Python Window") tabs = JTabbedPane() # Create Interactive Pane interactive_pane = JPanel(BorderLayout()) scrollpane = JScrollPane() inputPanel = JPanel() inputPanel.layout = GridLayout(1, 1) self.check_disabled = LockManager() self.input = InteractiveInput(self.check_disabled, self.runcode) self.input.component.document.addDocumentListener(self) inputPanel.add(self.input.component) self.outputpane = OutputPane() scrollpane.viewport.view = self.outputpane.textpane interactive_pane.add(scrollpane, BorderLayout.CENTER) interactive_pane.add(inputPanel, BorderLayout.PAGE_END) # Create Script Pane script_pane = JPanel(BorderLayout()) scrollpane = JScrollPane() self.script_area = script_area = InputPane() line_numbers = LineNumbering(self.script_area.component) scrollpane.viewport.view = self.script_area.component scrollpane.rowHeaderView = line_numbers.component script_pane.add(scrollpane, BorderLayout.CENTER) tabs.addTab("Interactive", interactive_pane) tabs.addTab("Script", script_pane) self.frame.add(tabs) self.frame.size = 500, 600 self.frame.visible = False self.component = None self.make_menubar() self.history = InputHistory()
def __init__(self): # Setup controls - buttons first self.playButton.preferredSize = self.refreshButton.preferredSize self.playButton.actionCommand = self.PLAY self.playButton.actionPerformed = self.whenButtonClicked self.pauseButton.preferredSize = self.refreshButton.preferredSize self.pauseButton.actionCommand = self.PAUSE self.pauseButton.actionPerformed = self.whenButtonClicked self.stopButton.preferredSize = self.refreshButton.preferredSize self.stopButton.actionCommand = self.STOP self.stopButton.actionPerformed = self.whenButtonClicked self.refreshButton.actionCommand = self.REFRESH self.refreshButton.actionPerformed = self.whenButtonClicked # Now combobox and text field self.sourceCombo.itemStateChanged = self.whenSourceChanged self.updateSourcesList() self.rangeSpinner.stateChanged = self.whenRangeChanged # Now sliders ticksMajor = int(self.posMinMax/4) ticksMinor = int(ticksMajor/5) labels = Hashtable(3) labels.put(-self.posMinMax, JLabel("Left")) labels.put( 0, JLabel("Centre")) labels.put( self.posMinMax, JLabel("Right")) self.positionXSlider.labelTable = labels self.positionXSlider.minimum = -self.posMinMax self.positionXSlider.maximum = self.posMinMax self.positionXSlider.majorTickSpacing = ticksMajor self.positionXSlider.minorTickSpacing = ticksMinor self.positionXSlider.paintTicks = True self.positionXSlider.paintLabels = True self.positionXSlider.snapToTicks = True self.positionXSlider.value = 0 self.positionXSlider.stateChanged = self.whenSliderXChanged labels = Hashtable(3) labels.put(-self.posMinMax, JLabel("Behind")) labels.put( 0, JLabel("Centre")) labels.put( self.posMinMax, JLabel("In-front")) self.positionYSlider.labelTable = labels self.positionYSlider.minimum = -self.posMinMax self.positionYSlider.maximum = self.posMinMax self.positionYSlider.majorTickSpacing = ticksMajor self.positionYSlider.minorTickSpacing = ticksMinor self.positionYSlider.paintTicks = True self.positionYSlider.paintLabels = True self.positionYSlider.snapToTicks = True self.positionYSlider.value = 0 self.positionYSlider.orientation = JSlider.VERTICAL self.positionYSlider.stateChanged = self.whenSliderYChanged labels = Hashtable(3) labels.put(-self.posMinMax, JLabel("Below")) labels.put( 0, JLabel("Centre")) labels.put( self.posMinMax, JLabel("Above")) self.positionZSlider.labelTable = labels self.positionZSlider.minimum = -self.posMinMax self.positionZSlider.maximum = self.posMinMax self.positionZSlider.majorTickSpacing = ticksMajor self.positionZSlider.minorTickSpacing = ticksMinor self.positionZSlider.paintTicks = True self.positionZSlider.paintLabels = True self.positionZSlider.snapToTicks = True self.positionZSlider.value = 0 self.positionZSlider.orientation = JSlider.VERTICAL self.positionZSlider.stateChanged = self.whenSliderZChanged # Setup frame self.title = "Simple JMRI Audio Player" self.contentPane.layout = BoxLayout(self.contentPane, BoxLayout.Y_AXIS) # Add controls to frame - combo & buttons first p = JPanel(FlowLayout(FlowLayout.LEADING)) p.add(self.sourceCombo) p.add(self.refreshButton) p.add(self.playButton) p.add(self.pauseButton) p.add(self.stopButton) #p.add(JLabel("Range")) #p.add(self.rangeSpinner) self.add(p) self.add(Box.createVerticalGlue()) # Now sliders p = JPanel(FlowLayout(FlowLayout.LEADING)) label = JLabel("Y Position") label.UI = VerticalLabelUI() # Default behaviour is anti-clockwise p.add(label) p.add(self.positionYSlider) p2 = JPanel() p2.layout = BoxLayout(p2, BoxLayout.Y_AXIS) p3 = JPanel() p3.add(JLabel("Range")) p3.add(self.rangeSpinner) p2.add(p3) #p2.add(Box.createVerticalGlue()) p3 = JPanel() p3.layout = BoxLayout(p3, BoxLayout.Y_AXIS) label = JLabel("X Position") label.alignmentX = JLabel.CENTER_ALIGNMENT p3.add(label) p3.add(self.positionXSlider) p2.add(p3) p.add(p2) label = JLabel("Z Position") label.UI = VerticalLabelUI() p.add(label) p.add(self.positionZSlider) self.add(p) # Finally pack and show self.pack() self.show()
def __init__(self): # Setup controls - buttons first self.playButton.preferredSize = self.refreshButton.preferredSize self.playButton.actionCommand = self.PLAY self.playButton.actionPerformed = self.whenButtonClicked self.pauseButton.preferredSize = self.refreshButton.preferredSize self.pauseButton.actionCommand = self.PAUSE self.pauseButton.actionPerformed = self.whenButtonClicked self.stopButton.preferredSize = self.refreshButton.preferredSize self.stopButton.actionCommand = self.STOP self.stopButton.actionPerformed = self.whenButtonClicked self.refreshButton.actionCommand = self.REFRESH self.refreshButton.actionPerformed = self.whenButtonClicked # Now combobox and text field self.sourceCombo.itemStateChanged = self.whenSourceChanged self.updateSourcesList() self.rangeSpinner.stateChanged = self.whenRangeChanged # Now sliders ticksMajor = int(self.posMinMax / 4) ticksMinor = int(ticksMajor / 5) labels = Hashtable(3) labels.put(-self.posMinMax, JLabel("Left")) labels.put(0, JLabel("Centre")) labels.put(self.posMinMax, JLabel("Right")) self.positionXSlider.labelTable = labels self.positionXSlider.minimum = -self.posMinMax self.positionXSlider.maximum = self.posMinMax self.positionXSlider.majorTickSpacing = ticksMajor self.positionXSlider.minorTickSpacing = ticksMinor self.positionXSlider.paintTicks = True self.positionXSlider.paintLabels = True self.positionXSlider.snapToTicks = True self.positionXSlider.value = 0 self.positionXSlider.stateChanged = self.whenSliderXChanged labels = Hashtable(3) labels.put(-self.posMinMax, JLabel("Behind")) labels.put(0, JLabel("Centre")) labels.put(self.posMinMax, JLabel("In-front")) self.positionYSlider.labelTable = labels self.positionYSlider.minimum = -self.posMinMax self.positionYSlider.maximum = self.posMinMax self.positionYSlider.majorTickSpacing = ticksMajor self.positionYSlider.minorTickSpacing = ticksMinor self.positionYSlider.paintTicks = True self.positionYSlider.paintLabels = True self.positionYSlider.snapToTicks = True self.positionYSlider.value = 0 self.positionYSlider.orientation = JSlider.VERTICAL self.positionYSlider.stateChanged = self.whenSliderYChanged labels = Hashtable(3) labels.put(-self.posMinMax, JLabel("Below")) labels.put(0, JLabel("Centre")) labels.put(self.posMinMax, JLabel("Above")) self.positionZSlider.labelTable = labels self.positionZSlider.minimum = -self.posMinMax self.positionZSlider.maximum = self.posMinMax self.positionZSlider.majorTickSpacing = ticksMajor self.positionZSlider.minorTickSpacing = ticksMinor self.positionZSlider.paintTicks = True self.positionZSlider.paintLabels = True self.positionZSlider.snapToTicks = True self.positionZSlider.value = 0 self.positionZSlider.orientation = JSlider.VERTICAL self.positionZSlider.stateChanged = self.whenSliderZChanged # Setup frame self.title = "Simple JMRI Audio Player" self.contentPane.layout = BoxLayout(self.contentPane, BoxLayout.Y_AXIS) # Add controls to frame - combo & buttons first p = JPanel(FlowLayout(FlowLayout.LEADING)) p.add(self.sourceCombo) p.add(self.refreshButton) p.add(self.playButton) p.add(self.pauseButton) p.add(self.stopButton) #p.add(JLabel("Range")) #p.add(self.rangeSpinner) self.add(p) self.add(Box.createVerticalGlue()) # Now sliders p = JPanel(FlowLayout(FlowLayout.LEADING)) label = JLabel("Y Position") label.UI = VerticalLabelUI() # Default behaviour is anti-clockwise p.add(label) p.add(self.positionYSlider) p2 = JPanel() p2.layout = BoxLayout(p2, BoxLayout.Y_AXIS) p3 = JPanel() p3.add(JLabel("Range")) p3.add(self.rangeSpinner) p2.add(p3) #p2.add(Box.createVerticalGlue()) p3 = JPanel() p3.layout = BoxLayout(p3, BoxLayout.Y_AXIS) label = JLabel("X Position") label.alignmentX = JLabel.CENTER_ALIGNMENT p3.add(label) p3.add(self.positionXSlider) p2.add(p3) p.add(p2) label = JLabel("Z Position") label.UI = VerticalLabelUI() p.add(label) p.add(self.positionZSlider) self.add(p) # Finally pack and show self.pack() self.show()
def openGUI(self, invocation): try: # Get values from request or response the extension is invoked from and prepopulate GUI values invMessage = invocation.getSelectedMessages() message = invMessage[0] originalHttpService = message.getHttpService() self.originalMsgProtocol = originalHttpService.getProtocol() self.originalMsgHost = originalHttpService.getHost() self.originalMsgPort = originalHttpService.getPort() except: self.originalMsgProtocol = '' self.originalMsgHost = '' self.originalMsgPort = '' try: self.cookies = self._callbacks.getCookieJarContents() self.cookie = '' except: pass self.SSL = 'http://' self.listType = '' self.parsedList = [] # Set up main window (JFrame) self.window = JFrame("Directory Listing Parser for Burp Suite", preferredSize=(600, 475), windowClosing=self.closeUI) self.window.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE) emptyBorder = BorderFactory.createEmptyBorder(10, 10, 10, 10) self.window.contentPane.setBorder(emptyBorder) self.window.contentPane.layout = BorderLayout() # Main window title placed at the top of the main window with an invisible bottom border titlePanel = JPanel() titleBorder = BorderFactory.createEmptyBorder(0, 0, 10, 0) title = JLabel("Directory Listing Parser for Burp Suite", JLabel.CENTER) title.setBorder(titleBorder) title.setFont(Font("Default", Font.PLAIN, 18)) titlePanel.add(title) self.window.contentPane.add("North", titlePanel) # Left panel for user input, consisting of hostname, directory prefix, ssl, port, type of listing, and file self.leftPanel = JPanel() self.leftPanel.layout = GridLayout(14, 1, 3, 3) hostnameLabel = JLabel("Hostname:") if self.originalMsgHost: self.hostnameTextField = JTextField(self.originalMsgHost.rstrip()) else: self.hostnameTextField = JTextField('Hostname') dirPrefixLabel = JLabel("Full Directory Prefix (Windows):") self.dirPrefixField = JTextField('C:\\var\www\\') sslLabel = JLabel("SSL:") self.radioBtnSslEnabled = JRadioButton('Enabled (https)', actionPerformed=self.radioSsl) self.radioBtnSslDisabled = JRadioButton('Disabled (http)', actionPerformed=self.radioSsl) sslButtonGroup = ButtonGroup() sslButtonGroup.add(self.radioBtnSslEnabled) sslButtonGroup.add(self.radioBtnSslDisabled) if self.originalMsgProtocol == "https": self.radioBtnSslEnabled.setSelected(True) else: self.radioBtnSslDisabled.setSelected(True) portLabel = JLabel("Port:") if self.originalMsgPort: self.portTextField = JTextField(str(self.originalMsgPort).rstrip()) else: self.portTextField = JTextField('80') osLabel = JLabel("Type of File Listing:") self.types = ('Windows \'dir /s\'', 'Linux \'ls -lR\'', 'Linux \'ls -R\'') self.comboListingType = JComboBox(self.types) uploadLabel = JLabel("Directory Listing File:") self.uploadTextField = JTextField('') uploadButton = JButton('Choose File', actionPerformed=self.chooseFile) self.leftPanel.add(hostnameLabel) self.leftPanel.add(self.hostnameTextField) self.leftPanel.add(dirPrefixLabel) self.leftPanel.add(self.dirPrefixField) self.leftPanel.add(sslLabel) self.leftPanel.add(self.radioBtnSslEnabled) self.leftPanel.add(self.radioBtnSslDisabled) self.leftPanel.add(portLabel) self.leftPanel.add(self.portTextField) self.leftPanel.add(osLabel) self.leftPanel.add(self.comboListingType) self.leftPanel.add(uploadLabel) self.leftPanel.add(self.uploadTextField) self.leftPanel.add(uploadButton) # Right panel consisting of a text area for the URL list self.UrlPanelLabel = JLabel("URL List:") self.textArea = JTextArea() self.textArea.setEditable(True) self.textArea.setFont(Font("Default", Font.PLAIN, 14)) if self.cookies: self.textArea.append('Cookies Found:\n') for cookie in self.cookies: if cookie.getDomain() in self.originalMsgHost: self.cookie += cookie.getName() + '=' + cookie.getValue() + '; ' self.textArea.append(cookie.getName() + '=' + cookie.getValue() + '\n') scrollArea = JScrollPane(self.textArea) scrollArea.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS) scrollArea.setPreferredSize(Dimension(400, 200)) self.rightPanel = JPanel() self.rightPanel.setLayout(BorderLayout(3, 3)) self.rightPanel.add(self.UrlPanelLabel, BorderLayout.NORTH) self.rightPanel.add(scrollArea, BorderLayout.CENTER) # Panel for the generate URL list and import URL list buttons generatePanel = JPanel() generatePanel.layout = BorderLayout(3, 3) generateButton = JButton('Generate URL List', actionPerformed=self.generateUrlList) importButton = JButton('Import URL List to Burp Site Map', actionPerformed=self.confirmImport) generatePanel.add("North", generateButton) generatePanel.add("South", importButton) self.rightPanel.add("South", generatePanel) # Add the two main panels to the left and right sides self.window.contentPane.add("East", self.rightPanel) self.window.contentPane.add("West", self.leftPanel) # Create a panel to be used for the file chooser window self.uploadPanel = JPanel() self.window.pack() self.window.show()