コード例 #1
0
ファイル: test_application.py プロジェクト: griffy/sikwidgets
	def launch_app(self):
		self.frame = JFrame("Test Window", defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
		pane = self.frame.getContentPane()
		layout = SpringLayout()
		pane.setLayout(layout)
		label = JLabel("Test Label")
		pane.add(label)
		layout.putConstraint(SpringLayout.WEST, label, 20, SpringLayout.WEST, pane)
		layout.putConstraint(SpringLayout.NORTH, label, 20, SpringLayout.NORTH, pane)
		self.frame.pack()
		self.frame.setVisible(True)
		self.frame.setSize(800, 600)
コード例 #2
0
ファイル: NewAtfView.py プロジェクト: willismonroe/nammu
 def __init__(self, controller, projects, languages, protocols):
     self.modalityType = Dialog.ModalityType.APPLICATION_MODAL
     self.controller = controller
     self.projects = projects
     self.languages = languages
     self.protocols = protocols
     self.cancelled = False
     self.springLayout = SpringLayout()
     self.pane = self.getContentPane()
コード例 #3
0
def show_gui():
    """
    Shows a GUI to select dss files to compare and select an input file
    """
    from javax.swing import JPanel, JFrame, JButton, SpringLayout, JTextBox
    from javax.swing.border import LineBorder
    textBox1 = JTextBox()
    textBox2 = JTextBox()
    file1ChooseButton = JButton("Choose File")
    file2ChooseButton = JButton("Choose File")
    contentPane = JPanel(SpringLayout())
    contentPane.setBorder(LineBorder(Color.blue))
    contentPane.add(JLabel("Alternative DSS File"))
    contentPane.add(textBox1)
    contentPane.add(file1ChooseButton)
    contentPane.add(JLabel("Base DSS File"))
    contentPane.add(textBox2)
    contentPane.add(file2ChooseButton)
    fr = JFrame("Calsim Report Generator")
    fr.contentPane().add(contentPane)
    fr.pack();fr.show();
コード例 #4
0
ファイル: NewAtfView.py プロジェクト: willismonroe/nammu
 def build_ampersand_row(self):
     '''
     Builds the &-line row.
     '''
     # Build own panel with SpringLayout.
     panel = JPanel()
     layout = SpringLayout()
     panel.setLayout(layout)
     # Create necessary components and add them to panel.
     ampersand_label = JLabel("CDLI's ID: ")
     self.left_field = JTextField('&')
     equals_label = JLabel('=')
     self.right_field = JTextField()
     tooltip_text = ("<html><body>This is the ID and text's designation "
                     "according to<br/>the CDLI catalog. If your text is "
                     "not yet in the<br/>catalog, please email "
                     "[email protected] to get<br/>an ID and designation.")
     help_label = self.build_help_label(tooltip_text)
     panel.add(ampersand_label)
     panel.add(self.left_field)
     panel.add(equals_label)
     panel.add(self.right_field)
     panel.add(help_label)
     # Set up constraints to tell panel how to position components.
     layout.putConstraint(SpringLayout.WEST, ampersand_label, 20,
                          SpringLayout.WEST, panel)
     layout.putConstraint(SpringLayout.NORTH, ampersand_label, 23,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.WEST, self.left_field, 90,
                          SpringLayout.WEST, panel)
     layout.putConstraint(SpringLayout.NORTH, self.left_field, 20,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.WEST, equals_label, 5,
                          SpringLayout.EAST, self.left_field)
     layout.putConstraint(SpringLayout.NORTH, equals_label, 23,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.WEST, self.right_field, 5,
                          SpringLayout.EAST, equals_label)
     layout.putConstraint(SpringLayout.NORTH, self.right_field, 20,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.WEST, help_label, 5,
                          SpringLayout.EAST, self.right_field)
     layout.putConstraint(SpringLayout.NORTH, help_label, 23,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.EAST, panel, 15, SpringLayout.EAST,
                          help_label)
     layout.putConstraint(SpringLayout.SOUTH, panel, 10, SpringLayout.SOUTH,
                          help_label)
     # Add this to NewAtf JFrame
     return panel
コード例 #5
0
ファイル: NewAtfView.py プロジェクト: willismonroe/nammu
    def build_buttons_row(self):
        '''
        Add OK/Cancel/Blank buttons.
        '''
        # Build own panel with SpringLayout.
        panel = JPanel()
        layout = SpringLayout()
        panel.setLayout(layout)
        # Create necessary components and add them to panel.
        create_button = JButton('Create template',
                                actionPerformed=self.create_template)
        leave_button = JButton('Leave blank', actionPerformed=self.blank)
        cancel_button = JButton('Cancel', actionPerformed=self.cancel)
        panel.add(create_button)
        panel.add(leave_button)
        panel.add(cancel_button)

        # Set up constraints to tell panel how to position components.
        layout.putConstraint(SpringLayout.WEST, create_button, 15,
                             SpringLayout.WEST, panel)
        layout.putConstraint(SpringLayout.NORTH, create_button, 15,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.WEST, leave_button, 5,
                             SpringLayout.EAST, create_button)
        layout.putConstraint(SpringLayout.NORTH, leave_button, 15,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.WEST, cancel_button, 5,
                             SpringLayout.EAST, leave_button)
        layout.putConstraint(SpringLayout.NORTH, cancel_button, 15,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.EAST, panel, 15, SpringLayout.EAST,
                             cancel_button)
        layout.putConstraint(SpringLayout.SOUTH, panel, 10, SpringLayout.SOUTH,
                             cancel_button)
        # Add this to NewAtf JFrame
        return panel
コード例 #6
0
ファイル: NewAtfView.py プロジェクト: willismonroe/nammu
 def build_language_row(self):
     '''
     Builds the language row.
     '''
     # Build own panel with SpringLayout.
     panel = JPanel()
     layout = SpringLayout()
     panel.setLayout(layout)
     # Get language list from settings.yaml, removing the default one from
     # the list
     languages = self.languages.keys()
     languages.remove('default')
     # Create necessary components and add them to panel.
     language_label = JLabel('Language: ')
     self.language_combo = JComboBox(languages)
     # Set selected language to default
     self.language_combo.setSelectedItem(self.languages['default'])
     tooltip_text = "Choose a language from the dropdown menu."
     help_label = self.build_help_label(tooltip_text)
     panel.add(language_label)
     panel.add(self.language_combo)
     panel.add(help_label)
     # Set up constraints to tell panel how to position components.
     layout.putConstraint(SpringLayout.WEST, language_label, 15,
                          SpringLayout.WEST, panel)
     layout.putConstraint(SpringLayout.NORTH, language_label, 18,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.WEST, self.language_combo, 90,
                          SpringLayout.WEST, panel)
     layout.putConstraint(SpringLayout.NORTH, self.language_combo, 15,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.WEST, help_label, 5,
                          SpringLayout.EAST, self.language_combo)
     layout.putConstraint(SpringLayout.NORTH, help_label, 18,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.EAST, panel, 15, SpringLayout.EAST,
                          help_label)
     layout.putConstraint(SpringLayout.SOUTH, panel, 10, SpringLayout.SOUTH,
                          help_label)
     # Add this to NewAtf JFrame
     return panel
コード例 #7
0
ファイル: NewAtfView.py プロジェクト: willismonroe/nammu
    def build_projects_row(self):
        '''
        Builds the projects row.
        '''
        # Build own panel with SpringLayout.
        panel = JPanel()
        layout = SpringLayout()
        panel.setLayout(layout)
        # Create necessary components and add them to panel.
        project_label = JLabel('Project: ')
        self.right_combo = JComboBox()
        self.right_combo.setEditable(True)

        def create_project_list():
            '''
            Prepares list of projects and subprojects ordered with the default
            one first.
            '''
            default_project = self.projects['default'][0].split('/')[0]
            if '/' in self.projects['default']:
                default_subproject = self.projects['default'].split('/')[1]
            else:
                default_subproject = ''
            projects = [default_project]
            subprojects = [default_subproject]
            # User created projects might not be in default dictionary
            for project in self.projects.keys():
                if (project != default_project and project != 'default'):
                    projects.append(project)
                # Default project might not have subproject
            if default_project in self.projects.keys():
                if default_subproject:
                    for subproject in self.projects[default_project]:
                        if (subproject != default_subproject):
                            subprojects.append(subproject)
            return projects, subprojects

        self.left_combo = JComboBox(create_project_list()[0])
        # Make left combo keep size no matter how long project names are
        self.left_combo.setPreferredSize(Dimension(125, 30))
        self.left_combo.setMinimumSize(self.left_combo.getPreferredSize())
        self.left_combo.setMaximumSize(self.left_combo.getPreferredSize())
        self.left_combo.setSize(self.left_combo.getPreferredSize())

        self.right_combo = JComboBox(create_project_list()[1])
        # Prevent right combo to change sizes dynamically
        self.right_combo.setPreferredSize(Dimension(100, 30))
        self.right_combo.setMinimumSize(self.left_combo.getPreferredSize())
        self.right_combo.setMaximumSize(self.left_combo.getPreferredSize())
        self.right_combo.setSize(self.left_combo.getPreferredSize())

        action_listener = ComboActionListener(self.right_combo, self.projects)
        self.left_combo.addActionListener(action_listener)
        self.left_combo.setEditable(True)
        self.right_combo.setEditable(True)

        slash_label = JLabel('/')

        tooltip_text = ("<html><body>Choose project from list or insert a new "
                        "one.<br/>You can leave the right-hand field blank."
                        "</body><html>")
        help_label = self.build_help_label(tooltip_text)
        panel.add(project_label)
        panel.add(self.left_combo)
        panel.add(slash_label)
        panel.add(self.right_combo)
        panel.add(help_label)
        # Set up constraints to tell panel how to position components.
        layout.putConstraint(SpringLayout.WEST, project_label, 15,
                             SpringLayout.WEST, panel)
        layout.putConstraint(SpringLayout.NORTH, project_label, 18,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.WEST, self.left_combo, 90,
                             SpringLayout.WEST, panel)
        layout.putConstraint(SpringLayout.NORTH, self.left_combo, 15,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.WEST, slash_label, 5,
                             SpringLayout.EAST, self.left_combo)
        layout.putConstraint(SpringLayout.NORTH, slash_label, 18,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.WEST, self.right_combo, 5,
                             SpringLayout.EAST, slash_label)
        layout.putConstraint(SpringLayout.NORTH, self.right_combo, 15,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.WEST, help_label, 5,
                             SpringLayout.EAST, self.right_combo)
        layout.putConstraint(SpringLayout.NORTH, help_label, 18,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.EAST, panel, 15, SpringLayout.EAST,
                             help_label)
        layout.putConstraint(SpringLayout.SOUTH, panel, 10, SpringLayout.SOUTH,
                             help_label)
        # Add this to NewAtf JFrame
        return panel
コード例 #8
0
ファイル: FindView.py プロジェクト: oracc/nammu
    def build_buttons_row(self):
        '''
        Builds the buttons row.
        '''
        panel = JPanel()
        layout = SpringLayout()
        panel.setLayout(layout)
        # Create necessary components and add them to panel.
        find_next_button = JButton('Find Next',
                                   actionPerformed=self.find_next)
        replace_one_button = JButton('Replace',
                                     actionPerformed=self.replace_one)
        replace_all_button = JButton('Replace All',
                                     actionPerformed=self.replace_all)
        done_button = JButton('Done', actionPerformed=self.done)
        panel.add(find_next_button)
        panel.add(replace_one_button)
        panel.add(replace_all_button)
        panel.add(done_button)

        # Set up constraints to tell panel how to position components.
        layout.putConstraint(SpringLayout.WEST,
                             find_next_button,
                             15,
                             SpringLayout.WEST,
                             panel)
        layout.putConstraint(SpringLayout.NORTH,
                             find_next_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             replace_one_button,
                             5,
                             SpringLayout.EAST,
                             find_next_button)
        layout.putConstraint(SpringLayout.NORTH,
                             replace_one_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             replace_all_button,
                             5,
                             SpringLayout.EAST,
                             replace_one_button)
        layout.putConstraint(SpringLayout.NORTH,
                             replace_all_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             done_button,
                             5,
                             SpringLayout.EAST,
                             replace_all_button)
        layout.putConstraint(SpringLayout.NORTH,
                             done_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.EAST,
                             panel,
                             15,
                             SpringLayout.EAST,
                             done_button)
        layout.putConstraint(SpringLayout.SOUTH,
                             panel,
                             10,
                             SpringLayout.SOUTH,
                             done_button)
        # Add this to NewAtf JFrame
        return panel
コード例 #9
0
ファイル: NewAtfView.py プロジェクト: oracc/nammu
 def build_ampersand_row(self):
     '''
     Builds the &-line row.
     '''
     # Build own panel with SpringLayout.
     panel = JPanel()
     layout = SpringLayout()
     panel.setLayout(layout)
     # Create necessary components and add them to panel.
     ampersand_label = JLabel("CDLI's ID: ")
     self.left_field = JTextField('&')
     equals_label = JLabel('=')
     self.right_field = JTextField()
     tooltip_text = ("<html><body>This is the ID and text's designation "
                     "according to<br/>the CDLI catalog. If your text is "
                     "not yet in the<br/>catalog, please email "
                     "[email protected] to get<br/>an ID and designation."
                     )
     help_label = self.build_help_label(tooltip_text)
     panel.add(ampersand_label)
     panel.add(self.left_field)
     panel.add(equals_label)
     panel.add(self.right_field)
     panel.add(help_label)
     # Set up constraints to tell panel how to position components.
     layout.putConstraint(SpringLayout.WEST,
                          ampersand_label,
                          20,
                          SpringLayout.WEST,
                          panel)
     layout.putConstraint(SpringLayout.NORTH,
                          ampersand_label,
                          23,
                          SpringLayout.NORTH,
                          panel)
     layout.putConstraint(SpringLayout.WEST,
                          self.left_field,
                          90,
                          SpringLayout.WEST,
                          panel)
     layout.putConstraint(SpringLayout.NORTH,
                          self.left_field,
                          20,
                          SpringLayout.NORTH,
                          panel)
     layout.putConstraint(SpringLayout.WEST,
                          equals_label,
                          5,
                          SpringLayout.EAST,
                          self.left_field)
     layout.putConstraint(SpringLayout.NORTH,
                          equals_label,
                          23,
                          SpringLayout.NORTH,
                          panel)
     layout.putConstraint(SpringLayout.WEST,
                          self.right_field,
                          5,
                          SpringLayout.EAST,
                          equals_label)
     layout.putConstraint(SpringLayout.NORTH,
                          self.right_field,
                          20,
                          SpringLayout.NORTH,
                          panel)
     layout.putConstraint(SpringLayout.WEST,
                          help_label,
                          5,
                          SpringLayout.EAST,
                          self.right_field)
     layout.putConstraint(SpringLayout.NORTH,
                          help_label,
                          23,
                          SpringLayout.NORTH,
                          panel)
     layout.putConstraint(SpringLayout.EAST,
                          panel,
                          15,
                          SpringLayout.EAST,
                          help_label)
     layout.putConstraint(SpringLayout.SOUTH,
                          panel,
                          10,
                          SpringLayout.SOUTH,
                          help_label)
     # Add this to NewAtf JFrame
     return panel
コード例 #10
0
ファイル: NewAtfView.py プロジェクト: oracc/nammu
    def build_buttons_row(self):
        '''
        Add OK/Cancel/Blank buttons.
        '''
        # Build own panel with SpringLayout.
        panel = JPanel()
        layout = SpringLayout()
        panel.setLayout(layout)
        # Create necessary components and add them to panel.
        create_button = JButton('Create template',
                                actionPerformed=self.create_template)
        leave_button = JButton('Leave blank', actionPerformed=self.blank)
        cancel_button = JButton('Cancel', actionPerformed=self.cancel)
        panel.add(create_button)
        panel.add(leave_button)
        panel.add(cancel_button)

        # Set up constraints to tell panel how to position components.
        layout.putConstraint(SpringLayout.WEST,
                             create_button,
                             15,
                             SpringLayout.WEST,
                             panel)
        layout.putConstraint(SpringLayout.NORTH,
                             create_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             leave_button,
                             5,
                             SpringLayout.EAST,
                             create_button)
        layout.putConstraint(SpringLayout.NORTH,
                             leave_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             cancel_button,
                             5,
                             SpringLayout.EAST,
                             leave_button)
        layout.putConstraint(SpringLayout.NORTH,
                             cancel_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.EAST,
                             panel,
                             15,
                             SpringLayout.EAST,
                             cancel_button)
        layout.putConstraint(SpringLayout.SOUTH,
                             panel,
                             10,
                             SpringLayout.SOUTH,
                             cancel_button)
        # Add this to NewAtf JFrame
        return panel
コード例 #11
0
ファイル: NewAtfView.py プロジェクト: oracc/nammu
 def build_language_row(self):
     '''
     Builds the language row.
     '''
     # Build own panel with SpringLayout.
     panel = JPanel()
     layout = SpringLayout()
     panel.setLayout(layout)
     # Get language list from settings.yaml, removing the default one from
     # the list
     languages = self.languages.keys()
     languages.remove('default')
     # Create necessary components and add them to panel.
     language_label = JLabel('Language: ')
     self.language_combo = JComboBox(languages)
     # Set selected language to default
     self.language_combo.setSelectedItem(self.languages['default'])
     tooltip_text = "Choose a language from the dropdown menu."
     help_label = self.build_help_label(tooltip_text)
     panel.add(language_label)
     panel.add(self.language_combo)
     panel.add(help_label)
     # Set up constraints to tell panel how to position components.
     layout.putConstraint(SpringLayout.WEST,
                          language_label,
                          15,
                          SpringLayout.WEST,
                          panel)
     layout.putConstraint(SpringLayout.NORTH,
                          language_label,
                          18,
                          SpringLayout.NORTH,
                          panel)
     layout.putConstraint(SpringLayout.WEST,
                          self.language_combo,
                          90,
                          SpringLayout.WEST,
                          panel)
     layout.putConstraint(SpringLayout.NORTH,
                          self.language_combo,
                          15,
                          SpringLayout.NORTH,
                          panel)
     layout.putConstraint(SpringLayout.WEST,
                          help_label,
                          5,
                          SpringLayout.EAST,
                          self.language_combo)
     layout.putConstraint(SpringLayout.NORTH,
                          help_label,
                          18,
                          SpringLayout.NORTH,
                          panel)
     layout.putConstraint(SpringLayout.EAST,
                          panel,
                          15,
                          SpringLayout.EAST,
                          help_label)
     layout.putConstraint(SpringLayout.SOUTH,
                          panel,
                          10,
                          SpringLayout.SOUTH,
                          help_label)
     # Add this to NewAtf JFrame
     return panel
コード例 #12
0
ファイル: NewAtfView.py プロジェクト: oracc/nammu
    def build_projects_row(self):
        '''
        Builds the projects row.
        '''
        # Build own panel with SpringLayout.
        panel = JPanel()
        layout = SpringLayout()
        panel.setLayout(layout)
        # Create necessary components and add them to panel.
        project_label = JLabel('Project: ')
        self.right_combo = JComboBox()
        self.right_combo.setEditable(True)

        def create_project_list():
            '''
            Prepares list of projects and subprojects ordered with the default
            one first.
            '''
            default_project = self.projects['default'][0].split('/')[0]
            if '/' in self.projects['default']:
                default_subproject = self.projects['default'].split('/')[1]
            else:
                default_subproject = ''
            projects = [default_project]
            subprojects = [default_subproject]
            # User created projects might not be in default dictionary
            for project in self.projects.keys():
                if (project != default_project and project != 'default'):
                    projects.append(project)
                # Default project might not have subproject
            if default_project in self.projects.keys():
                if default_subproject:
                    for subproject in self.projects[default_project]:
                        if (subproject != default_subproject):
                            subprojects.append(subproject)
            return projects, subprojects

        self.left_combo = JComboBox(create_project_list()[0])
        # Make left combo keep size no matter how long project names are
        self.left_combo.setPreferredSize(Dimension(125, 30))
        self.left_combo.setMinimumSize(self.left_combo.getPreferredSize())
        self.left_combo.setMaximumSize(self.left_combo.getPreferredSize())
        self.left_combo.setSize(self.left_combo.getPreferredSize())

        self.right_combo = JComboBox(create_project_list()[1])
        # Prevent right combo to change sizes dynamically
        self.right_combo.setPreferredSize(Dimension(100, 30))
        self.right_combo.setMinimumSize(self.left_combo.getPreferredSize())
        self.right_combo.setMaximumSize(self.left_combo.getPreferredSize())
        self.right_combo.setSize(self.left_combo.getPreferredSize())

        action_listener = ComboActionListener(self.right_combo,
                                              self.projects)
        self.left_combo.addActionListener(action_listener)
        self.left_combo.setEditable(True)
        self.right_combo.setEditable(True)

        slash_label = JLabel('/')

        tooltip_text = ("<html><body>Choose project from list or insert a new "
                        "one.<br/>You can leave the right-hand field blank."
                        "</body><html>")
        help_label = self.build_help_label(tooltip_text)
        panel.add(project_label)
        panel.add(self.left_combo)
        panel.add(slash_label)
        panel.add(self.right_combo)
        panel.add(help_label)
        # Set up constraints to tell panel how to position components.
        layout.putConstraint(SpringLayout.WEST,
                             project_label,
                             15,
                             SpringLayout.WEST,
                             panel)
        layout.putConstraint(SpringLayout.NORTH,
                             project_label,
                             18,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             self.left_combo,
                             90,
                             SpringLayout.WEST,
                             panel)
        layout.putConstraint(SpringLayout.NORTH,
                             self.left_combo,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             slash_label,
                             5,
                             SpringLayout.EAST,
                             self.left_combo)
        layout.putConstraint(SpringLayout.NORTH,
                             slash_label,
                             18,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             self.right_combo,
                             5,
                             SpringLayout.EAST,
                             slash_label)
        layout.putConstraint(SpringLayout.NORTH,
                             self.right_combo,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             help_label,
                             5,
                             SpringLayout.EAST,
                             self.right_combo)
        layout.putConstraint(SpringLayout.NORTH,
                             help_label,
                             18,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.EAST,
                             panel,
                             15,
                             SpringLayout.EAST,
                             help_label)
        layout.putConstraint(SpringLayout.SOUTH,
                             panel,
                             10,
                             SpringLayout.SOUTH,
                             help_label)
        # Add this to NewAtf JFrame
        return panel
コード例 #13
0
ファイル: FindView.py プロジェクト: willismonroe/nammu
    def build_buttons_row(self):
        '''
        Builds the buttons row.
        '''
        panel = JPanel()
        layout = SpringLayout()
        panel.setLayout(layout)
        # Create necessary components and add them to panel.
        find_next_button = JButton('Find Next', actionPerformed=self.find_next)
        replace_one_button = JButton('Replace',
                                     actionPerformed=self.replace_one)
        replace_all_button = JButton('Replace All',
                                     actionPerformed=self.replace_all)
        done_button = JButton('Done', actionPerformed=self.done)
        panel.add(find_next_button)
        panel.add(replace_one_button)
        panel.add(replace_all_button)
        panel.add(done_button)

        # Set up constraints to tell panel how to position components.
        layout.putConstraint(SpringLayout.WEST, find_next_button, 15,
                             SpringLayout.WEST, panel)
        layout.putConstraint(SpringLayout.NORTH, find_next_button, 15,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.WEST, replace_one_button, 5,
                             SpringLayout.EAST, find_next_button)
        layout.putConstraint(SpringLayout.NORTH, replace_one_button, 15,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.WEST, replace_all_button, 5,
                             SpringLayout.EAST, replace_one_button)
        layout.putConstraint(SpringLayout.NORTH, replace_all_button, 15,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.WEST, done_button, 5,
                             SpringLayout.EAST, replace_all_button)
        layout.putConstraint(SpringLayout.NORTH, done_button, 15,
                             SpringLayout.NORTH, panel)
        layout.putConstraint(SpringLayout.EAST, panel, 15, SpringLayout.EAST,
                             done_button)
        layout.putConstraint(SpringLayout.SOUTH, panel, 10, SpringLayout.SOUTH,
                             done_button)
        # Add this to NewAtf JFrame
        return panel