def run(self): frame = JFrame('FrameMethods', size=(1000, 500), locationRelativeTo=None, layout=GridLayout(0, 2), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) self.one = self.parse(self.textFile('JFrame Methods.txt')) self.left = JTextArea(self.one, 20, 40, editable=0, font=Font('Courier', Font.PLAIN, 12)) frame.add(JScrollPane(self.left)) self.two = self.parse(self.textFile('JInternalFrame Methods.txt')) self.right = JTextArea(self.two, 20, 40, editable=0, font=Font('Courier', Font.PLAIN, 12)) frame.add(JScrollPane(self.right)) frame.setJMenuBar(self.makeMenu()) frame.setVisible(1)
def __init__(self): #Class variable declarations self.mainPanel = JPanel(GridLayout(1, 2)) self.subPanel1 = JPanel(BorderLayout()) self.subPanel2 = JPanel(GridLayout(5, 1)) self.userText = JTextArea(' ') self.emoticonFeedback = JTextArea( 'This will consider your emoticon usage.') self.curseFeedback = JTextArea( 'This will consider your use of profanity.') self.styleFeedback = JTextArea('This will consider your general tone.') self.overallFeedback = JTextArea('This will be your overall score.') self.button = JButton("Score my email!", actionPerformed=self.updateScores) self.initGUI() self.add(self.mainPanel) self.setSize(800, 500) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setVisible(True)
def make_chf_panel(self): """ chf --> common hseg files """ chf_panel = JPanel() chf_panel.setLayout(MigLayout('insets 0')) chf_files_label = JLabel('Hemisegment cells') chf_files_text = JTextArea( BobGui.archetype_to_str( self.exper.hseg_cell_files_cab().archetype)) chf_panel.add(chf_files_label, 'growx, wrap') chf_panel.add(chf_files_text, 'grow, wrap') chf_files_label = JLabel('Hemisegment binary image files') chf_files_text = JTextArea( BobGui.archetype_to_str(self.exper.hseg_bin_files_cab().archetype)) chf_panel.add(chf_files_label, 'growx, wrap') chf_panel.add(chf_files_text, 'grow, wrap') chf_files_label = JLabel('Intensity Image Files') # chf_files_text = JTextArea(BobGui.archetype_to_str(self.exper.hseg_intens_im_files_cab().archetype)) # print(self.exper.hseg_intens_im_files_cab().archetype) # chf_panel.add(chf_files_label, 'growx, wrap') # chf_panel.add(chf_files_text, 'grow, wrap') self.intens_im_boxes = [] intens_im_panel = JPanel() intens_im_panel.setLayout(MigLayout('insets 0')) for poss_im_file in self.exper.hseg_intens_im_files_cab().archetype: self.intens_im_boxes.append(JCheckBox(poss_im_file)) intens_im_panel.add(self.intens_im_boxes[-1], 'wrap') chf_panel.add(chf_files_label, 'growx, wrap') chf_panel.add(intens_im_panel, 'grow, wrap') mdf_create_button = JButton( 'Create meta_data file from default outline') # mdf_create_button = JButton('<html>Create meta_data file<br>from default outline</html>') mdf_create_button.addActionListener( ActionListenerFactory(self, self.mdf_create_al)) mdf_open_button = JButton('Open existing meta_data file') mdf_open_button.addActionListener( ActionListenerFactory(self, self.mdf_open_al)) # meta_data_file_buttton = JButton('Open/Create meta_data file') # meta_data_file_buttton.addActionListener(ActionListenerFactory(self, self.meta_data_al)) # chf_panel.add(meta_data_file_buttton) chf_panel.add(mdf_create_button, 'wrap') chf_panel.add(mdf_open_button, 'wrap') chf_scroll_pane = JScrollPane() chf_scroll_pane.getViewport().setView(chf_panel) return chf_scroll_pane
def __init__(self, extender): self._callbacks = extender._callbacks self._helpers = extender._callbacks.getHelpers() self._callbacks.registerScannerCheck(self) # Creamos el contenedor de paneles. self.contenedor = JTabbedPane() # Campos del sub-tab 1 (mash up) self._tab1_nombre = JTextField() self._tab1_apellido = JTextField() self._tab1_FNacimiento = JTextField() self._tab1_mascota = JTextField() self._tab1_otro = JTextField() self._tab1_feedback_ta = JTextArea('This may take a while . . .') self._tab1_feedback_ta.setEditable(False) self._tab1_feedback_sp = JScrollPane(self._tab1_feedback_ta) self._tab1_minsize = JSlider(4, 16, 6) self._tab1_minsize.setMajorTickSpacing(1) self._tab1_minsize.setPaintLabels(True) self._tab1_maxsize = JSlider(4, 16, 10) self._tab1_maxsize.setMajorTickSpacing(1) self._tab1_maxsize.setPaintLabels(True) self._tab1_specialchars = JTextField('!,@,#,$,&,*') self._tab1_transformations = JCheckBox('1337 mode') self._tab1_firstcapital = JCheckBox('first capital letter') # Campos del sub-tab 2 (redirect) self._tab2_JTFa = JTextField() self._tab2_JTFaa = JTextField() self._tab2_JTFb = JTextField() self._tab2_JTFbb = JTextField() self._tab2_boton = JButton(' Redirect is Off ', actionPerformed=self.switch_redirect) self._tab2_boton.background = Color.lightGray self._tab2_encendido = False # Campos del sub-tab 3 (loader) self._tab3_urls_ta = JTextArea(15, 5) self._tab3_urls_sp = JScrollPane(self._tab3_urls_ta) # Campos del sub-tab 4 (headers) self._tab4_tabla_model = DefaultTableModel() self._tab4_headers_dict = {} # Campos del sub-tab 5 (reverse ip) self._tab5_target = JTextArea(15, 5) self._tab5_target_sp = JScrollPane(self._tab5_target)
def run(self): frame = JFrame('Available Fonts', defaultCloseOperation=JFrame.EXIT_ON_CLOSE) #----------------------------------------------------------------------- # First, we a local graphics environment (LGE) instance. Then, we call # its getAvailableFontFamilyNames() method to obtain the list of all # available font names. #----------------------------------------------------------------------- lge = GraphicsEnvironment.getLocalGraphicsEnvironment() fontNames = lge.getAvailableFontFamilyNames() #----------------------------------------------------------------------- # The JTextArea will be used to hold the names of the available fonts. # Unfortunately, we don't know, for certain, how many font names are # present. So, we need to have the JTextArea be within a JScrollPane, # "just in case" too many names exist for us to display at one time. ;-) #----------------------------------------------------------------------- frame.add( JScrollPane( JTextArea('\n'.join(fontNames), editable=0, rows=8, columns=32))) frame.pack() frame.setVisible(1)
def run(self): frame = JFrame('ComponentEventDemo', locationRelativeTo=None, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) cp = frame.getContentPane() cp.setLayout(BorderLayout()) self.display = JTextArea(editable=0, font=Font('Courier', Font.PLAIN, 12)) myListener = listener(self.display) frame.addComponentListener(myListener) scrollPane = JScrollPane(self.display, preferredSize=Dimension(350, 210)) cp.add(scrollPane, BorderLayout.CENTER) panel = JPanel(BorderLayout(), componentListener=myListener) self.button = JButton('Clear', actionPerformed=self.clear, componentListener=myListener) panel.add(self.button, BorderLayout.CENTER) visible = JCheckBox('Button visible', selected=1, itemStateChanged=self.showHide, componentListener=myListener) panel.add(visible, BorderLayout.PAGE_END) cp.add(panel, BorderLayout.PAGE_END) frame.pack() frame.setVisible(1)
def complex_console(): global frame #generates frame frame = JFrame("[BETA] Game Master\'s Bot - Console Log") frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE) frame.setResizable(False) frame.setAlwaysOnTop(True) frame.setBounds(8,545,600,130) frame.contentPane.layout = FlowLayout() #add QUIT button quitButton = JButton("QUIT", actionPerformed = closeFrame) quitButton.setForeground(Color.RED) quitButton.setPreferredSize(Dimension(100,100)) frame.contentPane.add(quitButton) #add text message global textArea textArea = JTextArea(6,38) textArea.setEditable(False) frame.contentPane.add(textArea) scrollPane = JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) frame.contentPane.add(scrollPane) #show frame frame.pack() frame.setVisible(True) log("Welcome to Game Master\'s Bot!")
def initUI(self): self.tab = JPanel() # UI for Output self.outputLabel = JLabel("AutoRecon Log:") self.outputLabel.setFont(Font("Tahoma", Font.BOLD, 14)) self.outputLabel.setForeground(Color(255, 102, 52)) self.logPane = JScrollPane() self.outputTxtArea = JTextArea() self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12)) self.outputTxtArea.setLineWrap(True) self.logPane.setViewportView(self.outputTxtArea) self.clearBtn = JButton("Clear Log", actionPerformed=self.clearLog) self.exportBtn = JButton("Export Log", actionPerformed=self.exportLog) self.parentFrm = JFileChooser() # Layout layout = GroupLayout(self.tab) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) self.tab.setLayout(layout) layout.setHorizontalGroup(layout.createParallelGroup().addGroup( layout.createSequentialGroup().addGroup( layout.createParallelGroup().addComponent( self.outputLabel).addComponent(self.logPane).addComponent( self.clearBtn).addComponent(self.exportBtn)))) layout.setVerticalGroup(layout.createParallelGroup().addGroup( layout.createParallelGroup().addGroup( layout.createSequentialGroup().addComponent( self.outputLabel).addComponent(self.logPane).addComponent( self.clearBtn).addComponent(self.exportBtn))))
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 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 ) : frame = JFrame( 'WSAShelp_01', locationRelativeTo = None, defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) # text = Help.help() # tabs = text.count( '\t' ) # text = Help.help().expandtabs() # rows = text.count( '\n' ) + 1 # cols = max( [ len( x ) for x in text.splitlines() ] ) # cols = max( [ len( x.expandtabs() ) for x in text.splitlines() ] ) # print '\nrows: %d cols: %d tabs: %d' % ( rows, cols, tabs ) frame.add( JScrollPane( JTextArea( # text, Help.help().expandtabs(), 20, 80, font = Font( 'Courier' , Font.PLAIN, 12 ) ) ) ) frame.pack() size = frame.getSize() # print 'frame.getSize():', size loc = frame.getLocation() # print 'frame.getLocation():', loc loc.x -= ( size.width >> 1 ) loc.y -= ( size.height >> 1 ) frame.setLocation( loc ) frame.setVisible( 1 )
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 registerExtenderCallbacks(self, callbacks): """extension startup""" # commons self.EXTENSION_NAME = 'Report2text' self.COLOR_RED = Color(0xff6633) self.COLOR_BLACK = Color(0x0) self._callbacks = callbacks self._helpers = self._callbacks.getHelpers() self._callbacks.setExtensionName(self.EXTENSION_NAME) # menu self._callbacks.registerContextMenuFactory(self) # output tab self._mainTextArea = JTextArea('initial text') self._mainTextArea.editable = False self._mainTextArea.setLineWrap(True) self._mainTextArea.setWrapStyleWord(True) self._mainTextArea.addFocusListener(self) self._tab = JPanel(BorderLayout()) self._tab.add(JScrollPane(self._mainTextArea)) self._callbacks.addSuiteTab(self) return
def getMainComponent(self): self._mainPanel = JPanel(BorderLayout()) # input self._consolePwd = JTextField() self._consolePwd.setEditable(False) self._consolePwd.setText("Not initialized") self._consoleInput = JTextField() #Remove 'tab' low-level tab-function of jumping to other component, so I can use it self._consoleInput.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET) self._consoleInput.addActionListener(self.EnterPress()) self._consoleInput.addKeyListener(self.KeyPress()) self._inputPanel = JPanel(BorderLayout()) self._inputPanel.add(self._consolePwd, BorderLayout.WEST) self._inputPanel.add(self._consoleInput, BorderLayout.CENTER) # output self._consoleOutput = JTextArea() self._consoleOutput.setEditable(False) self._consoleOutput.setForeground(Color.WHITE) self._consoleOutput.setBackground(Color.BLACK) self._consoleOutput.setFont(self._consoleOutput.getFont().deriveFont(12.0)) self._scrollPaneConsoleOutput = JScrollPane(self._consoleOutput) # Add to main panel and return the main panel self._mainPanel.add(self._scrollPaneConsoleOutput, BorderLayout.CENTER) self._mainPanel.add(self._inputPanel, BorderLayout.SOUTH) return self._mainPanel
def initUI(self): """ Finished Dialog box Simple dialog box that says "Finished", to bw displayed when all image analysis has finished. When OK button is pressed all ImageJ windows are closed. """ panel = JPanel() self.getContentPane().add(panel) panel.setBackground(Color.WHITE) panel.setLayout(None) self.setTitle("Analysis has finished") self.setSize(300, 150) OKbutton = JButton("OK", actionPerformed=self.onOK) OKbutton.setBackground(Color.BLACK) OKbutton.setBounds(80, 50, 100, 30) panel.add(OKbutton) Title = JTextArea("Analysis has finised!! :-)") Title.setBounds(15, 10, 250, 20) panel.add(Title) self.setLocationRelativeTo(None) self.setLocation(int(IJ.getScreenSize().width * 0.01), int(IJ.getScreenSize().height * 3 / 10)) self.setVisible(True)
def createInfoLabel(text): textArea = JTextArea() textArea.setLineWrap(True) textArea.setWrapStyleWord(True) textArea.setOpaque(False) textArea.setEditable(False) return textArea
def initial(): global f ##文件 global txt global number_of_occurrence reload(sys) sys.setdefaultencoding('utf-8') ctr.init() ctr.set_value('flag', 0) ctr.set_value('reload_check', 0) ctr.set_value('world_boss_check', 0) ctr.set_value('raid_check', 0) #ctr.set_value('raid_check',None) number_of_occurrence = 0 ctr.set_value('max_level_check', None) ctr.set_value('return_check', 0) ticks = time.time() date = time.strftime("%Y_%m_%d_%H_%M_%S", time.localtime(ticks)) + '_日誌' f = open(date + '.txt', 'w', 0) frame = JFrame("Log") txt = JTextArea(19, 55) scrollPane = JScrollPane(txt) ##frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setLocation(2000, 100) frame.setSize(480, 450) frame.setLayout(FlowLayout()) ##label = JLabel('記錄:') scrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) ##frame.add(label) frame.add(scrollPane) frame.setVisible(True)
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 run( self ) : frame = JFrame( 'Listen3', layout = FlowLayout(), locationRelativeTo = None, size = ( 512, 256 ), defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) frame.add( JLabel( 'Input:', horizontalAlignment = SwingConstants.RIGHT ) ) self.text = frame.add( JTextField( 8 ) ) frame.add( JButton( 'Clear', actionPerformed = self.clear ) ) self.textArea = JTextArea( rows = 10, columns = 40 ) frame.add( JScrollPane( self.textArea ) ) self.text.addKeyListener( listener( self.textArea ) ) frame.setVisible( 1 )
def set_description_tab(self, fn, vn): description_text = str(self.checklist["Functionality"][fn]["tests"][vn]["description"]) description_textarea = JTextArea() description_textarea.setLineWrap(True) description_textarea.setText(description_text) description_panel = JScrollPane(description_textarea) return description_panel
def getListCellRendererComponent(self, lst, value, index, isSelected, cellHasFocus): text = value["text"] renderer = JTextArea(text=text) renderer.foreground = self.colormap[value["type"]] renderer.font = self.font if isSelected: renderer.background = Color.YELLOW return renderer
def __init__(self, frame): JWindow.__init__(self, frame) self.textarea = JTextArea() # TODO put this color with all the other colors self.textarea.setBackground(Color(225,255,255)) self.textarea.setEditable(0) self.jscrollpane = JScrollPane(self.textarea) self.getContentPane().add(self.jscrollpane)
def run_fn(event): log_window = JFrame('Galahad Log') log_text_area = JTextArea() log_text_area.editable = False log_window.setSize(400, 500) log_window.add(log_text_area) log_window.show() log_text_area.append('sdfsdfsdfsdfsd %d' % 3)
def make_code_editor(): import inspect panel = JPanel(BorderLayout(2, 2)) self.codeArea = JTextArea() self.codeArea.text = self.scoringModule and inspect.getsource( self.scoringModule) or "" panel.add(JScrollPane(self.codeArea), BorderLayout.CENTER) return panel
def __init__(self, person, chatui): """ConversationWindow(basesupport.AbstractPerson:person)""" Conversation.__init__(self, person, chatui) self.mainframe = JFrame("Conversation with " + person.name) self.display = JTextArea(columns=100, rows=15, editable=0, lineWrap=1) self.typepad = JTextField() self.buildpane() self.lentext = 0
def make_tree(self): print('make_tree') root = DefaultMutableTreeNode(self.exper.name) sb = br.SimilarityBuilder() for hseg in self.exper.hsegs(): all_file_dict = hseg.file_dict() all_file_dict.update(hseg.cell_file_dict()) all_file_dict.update(hseg.bin_file_dict()) sb.add_group(hseg.name, all_file_dict) simprofile, comparisons = sb.simprofile_comparison() sim_str = '' for val in simprofile: sim_str += str(val) + '\n' tp = JTextArea(sim_str) stp = JScrollPane() stp.getViewport().setView(tp) # # stp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); # stp.setPreferredSize(Dimension(250, 250)); # tp.setPreferredSize(Dimension(250, 250)) stp_panel = JPanel(BorderLayout()) stp_panel.add(tp, BorderLayout.CENTER) # self.add(stp_panel, 'grow') for hseg in self.exper.hsegs(): hseg_node = DefaultMutableTreeNode(hseg.name) root.add(hseg_node) if len(comparisons[hseg.name]) > 0: for definer, file_names in comparisons[hseg.name].items(): for file_name in file_names: node_str = definer + ': ' + file_name hseg_node.add(DefaultMutableTreeNode(node_str)) # for file_suf in hseg.file_dict() : # hseg_node.add(DefaultMutableTreeNode(file_suf)) self.tree = JTree(root) scrollPane = JScrollPane() scrollPane.getViewport().setView((self.tree)) # scrollPan # scrollPane.setPreferredSize(Dimension(300,250)) tree_panel = JPanel(BorderLayout()) tree_panel.add(scrollPane, BorderLayout.CENTER) combo_panel = JPanel(GridLayout(0, 2, 10, 10)) # combo_panel.setLayout(BoxLayout(combo_panel, BoxLayout.X_AXIS)) combo_panel.add(stp_panel) #, BorderLayout.LINE_START) combo_panel.add(tree_panel) #, BorderLayout.LINE_END) self.panel.add(combo_panel) # self.add(scrollPane, 'grow') self.revalidate()
def __init__(self): super(BeautifierPanel, self).__init__() self.setLayout(BorderLayout()) self.beautifyTextArea = JTextArea(5, 10) self.beautifyTextArea.setLineWrap(True) self.beautifyTextArea.setDocument(self.CustomUndoPlainDocument()) # The undo doesn't work well before replace text. Below is rough fix, so not need to know how undo work for now self.beautifyTextArea.setText(" ") self.beautifyTextArea.setText("") self.undoManager = UndoManager() self.beautifyTextArea.getDocument().addUndoableEditListener( self.undoManager) self.beautifyTextArea.getDocument().addDocumentListener( self.BeautifyDocumentListener(self)) beautifyTextWrapper = JPanel(BorderLayout()) beautifyScrollPane = JScrollPane(self.beautifyTextArea) beautifyTextWrapper.add(beautifyScrollPane, BorderLayout.CENTER) self.add(beautifyTextWrapper, BorderLayout.CENTER) self.beautifyButton = JButton("Beautify") self.beautifyButton.addActionListener(self.beautifyListener) self.undoButton = JButton("Undo") self.undoButton.addActionListener(self.undoListener) formatLabel = JLabel("Format:") self.formatsComboBox = JComboBox() for f in supportedFormats: self.formatsComboBox.addItem(f) self.statusLabel = JLabel("Status: Ready") preferredDimension = self.statusLabel.getPreferredSize() self.statusLabel.setPreferredSize( Dimension(preferredDimension.width + 20, preferredDimension.height)) self.sizeLabel = JLabel("0 B") preferredDimension = self.sizeLabel.getPreferredSize() self.sizeLabel.setPreferredSize( Dimension(preferredDimension.width + 64, preferredDimension.height)) self.sizeLabel.setHorizontalAlignment(SwingConstants.RIGHT) buttonsPanel = JPanel(FlowLayout()) buttonsPanel.add(formatLabel) buttonsPanel.add(self.formatsComboBox) buttonsPanel.add(Box.createHorizontalStrut(10)) buttonsPanel.add(self.beautifyButton) buttonsPanel.add(self.undoButton) bottomPanel = JPanel(BorderLayout()) bottomPanel.add(self.statusLabel, BorderLayout.WEST) bottomPanel.add(buttonsPanel, BorderLayout.CENTER) bottomPanel.add(self.sizeLabel, BorderLayout.EAST) self.add(bottomPanel, BorderLayout.SOUTH) self.currentBeautifyThread = None
def set_response_tab_pane(self, request_response): raw_response = request_response.getResponse() response_body = StringUtil.fromBytes(raw_response) response_body = response_body.encode("utf-8") response_tab_textarea = JTextArea(response_body) response_tab_textarea.setLineWrap(True) return JScrollPane(response_tab_textarea)
def getUiComponent(self): self.HaEPanel = JPanel() self.HaEPanel.setBorder(None) self.HaEPanel.setLayout(BorderLayout(0, 0)) self.panel = JPanel() self.HaEPanel.add(self.panel, BorderLayout.NORTH) self.panel.setLayout(BorderLayout(0, 0)) self.tabbedPane = JTabbedPane(JTabbedPane.TOP) self.panel.add(self.tabbedPane, BorderLayout.CENTER) self.setPanel = JPanel() self.tabbedPane.addTab("Set", None, self.setPanel, None) self.setPanel.setLayout(BorderLayout(0, 0)) self.setPanel_1 = JPanel() self.setPanel.add(self.setPanel_1, BorderLayout.NORTH) self.nameString = JLabel("Name") self.setPanel_1.add(self.nameString) self.nameTextField = JTextField() self.setPanel_1.add(self.nameTextField) self.nameTextField.setColumns(10) self.regexString = JLabel("Regex") self.setPanel_1.add(self.regexString) self.regexTextField = JTextField() self.setPanel_1.add(self.regexTextField) self.regexTextField.setColumns(10) self.extractCheckBox = JCheckBox("Extract") self.setPanel_1.add(self.extractCheckBox) self.highlightCheckBox = JCheckBox("Highlight") self.setPanel_1.add(self.highlightCheckBox) self.setPanel_2 = JPanel() self.setPanel.add(self.setPanel_2) self.colorString = JLabel("Color") self.setPanel_2.add(self.colorString) self.colorTextField = JTextField() self.setPanel_2.add(self.colorTextField) self.colorTextField.setColumns(5) self.addBottun = JButton("Add", actionPerformed=self.addConfig) self.setPanel_2.add(self.addBottun) self.tipString = JLabel("") self.setPanel_2.add(self.tipString) self.configPanel = JPanel() self.tabbedPane.addTab("Config", None, self.configPanel, None) self.configPanel.setLayout(BorderLayout(0, 0)) self.configString = JLabel("This is config file content.") self.configString.setHorizontalAlignment(SwingConstants.CENTER) self.configPanel.add(self.configString, BorderLayout.NORTH) self.configTextArea = JTextArea() self.configTextArea.setEnabled(False) self.configTextArea.setTabSize(4) self.configTextArea.setLineWrap(True) self.configTextArea.setRows(20) self.configPanel.add(self.configTextArea, BorderLayout.SOUTH) self.scrollPane = JScrollPane(self.configTextArea) self.configPanel.add(self.scrollPane, BorderLayout.SOUTH) self.reloadButton = JButton("Reload", actionPerformed=self.reloadConfig) self.configPanel.add(self.reloadButton, BorderLayout.CENTER) return self.HaEPanel