Beispiel #1
0
    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)
Beispiel #2
0
    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))
Beispiel #3
0
    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)
Beispiel #4
0
 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
Beispiel #5
0
    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))
Beispiel #6
0
    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))
Beispiel #7
0
    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.vehicleLabel, gc)

        gc.gridx = 1
        gc.anchor = GridBagConstraints.LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.vehicleField, 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.bypassBtn, gc)

        innerBorder = BorderFactory.createTitledBorder('Emergency Bypass')
        outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5)
        self.setBorder(
            BorderFactory.createCompoundBorder(outerBorder, innerBorder))
Beispiel #8
0
    def initComponents(self):

        #set the layout and add form components
        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.nameLabel, gc)

        gc.gridx = 1
        gc.anchor = GridBagConstraints.LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.nameField, 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.mobLabel, gc)

        gc.gridx = 1

        gc.anchor = GridBagConstraints.LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.mobField, gc)

        #Third Row
        gc.gridy += 1

        gc.weightx = 1
        gc.weighty = 0.1
        gc.gridx = 0
        gc.anchor = GridBagConstraints.FIRST_LINE_END
        gc.insets = Insets(0, 0, 0, 5)
        self.add(self.emailLabel, gc)

        gc.weightx = 1
        gc.weighty = 0.2
        gc.gridx = 1
        gc.anchor = GridBagConstraints.FIRST_LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.emailField, gc)

        #Next Row
        gc.gridy += 1
        gc.weightx = 1
        gc.weighty = 0.1
        gc.gridx = 0
        gc.anchor = GridBagConstraints.FIRST_LINE_END
        gc.insets = Insets(0, 0, 0, 5)
        self.add(self.userNameLabel, gc)

        gc.weightx = 1
        gc.weighty = 0.2
        gc.gridx = 1
        gc.anchor = GridBagConstraints.FIRST_LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.userNameField, gc)

        # Next Row
        gc.gridy += 1
        gc.weightx = 1
        gc.weighty = 0.1
        gc.gridx = 0
        gc.anchor = GridBagConstraints.FIRST_LINE_END
        gc.insets = Insets(0, 0, 0, 5)
        self.add(self.passwordLabel, gc)

        gc.weightx = 1
        gc.weighty = 0.2
        gc.gridx = 1
        gc.anchor = GridBagConstraints.FIRST_LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.passwordField, gc)

        # Next Row
        gc.gridy += 1
        gc.weightx = 1
        gc.weighty = 0.1
        gc.gridx = 0
        gc.anchor = GridBagConstraints.FIRST_LINE_END
        gc.insets = Insets(0, 0, 0, 5)
        self.add(self.confirmPasswordLabel, gc)

        gc.weightx = 1
        gc.weighty = 0.2
        gc.gridx = 1
        gc.anchor = GridBagConstraints.FIRST_LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.confirmPasswordField, gc)

        # Next Row
        gc.gridy += 1
        gc.weightx = 1
        gc.weighty = 0.1
        gc.gridx = 0
        gc.anchor = GridBagConstraints.FIRST_LINE_END
        gc.insets = Insets(0, 0, 0, 5)
        self.add(self.superPassLabel, gc)

        gc.weightx = 1
        gc.weighty = 0.2
        gc.gridx = 1
        gc.anchor = GridBagConstraints.FIRST_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.addAdminBtn, gc)

        innerBorder = BorderFactory.createTitledBorder('Add Admin')
        outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5)
        self.setBorder(
            BorderFactory.createCompoundBorder(outerBorder, innerBorder))
Beispiel #9
0
    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.nameLabel, gc)

        gc.gridx = 1
        gc.anchor = GridBagConstraints.LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.nameField, 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.mobLabel, gc)

        gc.gridx = 1

        gc.anchor = GridBagConstraints.LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.mobField, gc)

        #Third Row
        gc.gridy += 1

        gc.weightx = 1
        gc.weighty = 0.1
        gc.gridx = 0
        gc.anchor = GridBagConstraints.FIRST_LINE_END
        gc.insets = Insets(0, 0, 0, 5)
        self.add(self.emailLabel, gc)

        gc.weightx = 1
        gc.weighty = 0.2
        gc.gridx = 1
        gc.anchor = GridBagConstraints.FIRST_LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.emailField, gc)

        #Next Row
        gc.gridy += 1
        gc.weightx = 1
        gc.weighty = 0.1
        gc.gridx = 0
        gc.anchor = GridBagConstraints.FIRST_LINE_END
        gc.insets = Insets(0, 0, 0, 5)
        self.add(self.vehicleLabel, gc)

        gc.weightx = 1
        gc.weighty = 0.2
        gc.gridx = 1
        gc.anchor = GridBagConstraints.FIRST_LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.vehicleField, gc)

        gc.weightx = 1
        gc.weighty = 0.2
        gc.gridx = 2
        gc.anchor = GridBagConstraints.FIRST_LINE_START
        gc.insets = Insets(0, 0, 0, 0)
        self.add(self.automateRecogBtn, 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.regBtn, gc)

        innerBorder = BorderFactory.createTitledBorder('Register Vehicle')
        outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5)
        self.setBorder(
            BorderFactory.createCompoundBorder(outerBorder, innerBorder))
Beispiel #10
0
c.fill = GridBagConstraints.NONE
c.weightx = 0.0  # let the previous ('path') component stretch as much as possible
parent = JButton("Open folder", actionPerformed=openAtFolder)
gb.setConstraints(parent, c)
all.add(parent)

# Middle-right textarea showing the text of a note associated with the selected table row image
c.gridx = 1
c.gridy = 1
c.weighty = 1.0
c.gridwidth = 3
c.fill = GridBagConstraints.BOTH
textarea = JTextArea()
textarea.setBorder(
    BorderFactory.createCompoundBorder(
        BorderFactory.createLineBorder(Color.BLACK),
        BorderFactory.createEmptyBorder(10, 10, 10, 10)))
textarea.setLineWrap(True)
textarea.setWrapStyleWord(True)  # wrap text by cutting lines at whitespace
textarea.setEditable(False)
font = textarea.getFont().deriveFont(18.0)
textarea.setFont(font)
textarea.setPreferredSize(Dimension(500, 500))
gb.setConstraints(textarea, c)
all.add(textarea)

# Bottom text label showing the status of the note: whether it's being edited, or saved.
c.gridx = 1
c.gridy = 2
c.gridwidth = 1
c.weightx = 0.5
Beispiel #11
0
    def __init__(self, extender, *rows, **kwargs):
        self.extender = extender

        if 'title' in kwargs:
            self.setBorder(
                BorderFactory.createCompoundBorder(
                    BorderFactory.createTitledBorder(kwargs.get('title', '')),
                    BorderFactory.createEmptyBorder(5, 5, 5, 5)))

        self.table = table = JTable(ParameterProcessingRulesTableModel(*rows))
        table.setPreferredScrollableViewportSize(Dimension(500, 70))
        table.setRowSorter(TableRowSorter(table.getModel()))
        table.setFillsViewportHeight(True)

        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [0, 0, 25, 0 ]
        gridBagLayout.rowHeights = [0, 0, 0, 0]
        gridBagLayout.columnWeights = [0.0, 1.0, 1.0, Double.MIN_VALUE]
        gridBagLayout.rowWeights = [0.0, 0.0, 0.0, Double.MIN_VALUE]
        self.setLayout(gridBagLayout)

        addButton = JButton("Add")
        addButton.addActionListener(AddRemoveParameterListener(table))
        addButtonConstraints = GridBagConstraints()
        addButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        addButtonConstraints.insets = Insets(0, 0, 5, 5) 
        addButtonConstraints.gridx = 0
        addButtonConstraints.gridy = 0
        self.add(addButton, addButtonConstraints)

        removeButton = JButton("Remove")
        removeButton.addActionListener(AddRemoveParameterListener(table))
        removeButtonConstraints = GridBagConstraints()
        removeButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        removeButtonConstraints.insets = Insets(0, 0, 5, 5) 
        removeButtonConstraints.gridx = 0
        removeButtonConstraints.gridy = 1
        self.add(removeButton, removeButtonConstraints)

        upButton = JButton("Up")
        upButton.addActionListener(AddRemoveParameterListener(table))
        upButtonConstraints = GridBagConstraints()
        upButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        upButtonConstraints.insets = Insets(0, 0, 5, 5) 
        upButtonConstraints.gridx = 0
        upButtonConstraints.gridy = 2
        self.add(upButton, upButtonConstraints)

        downButton = JButton("Down")
        downButton.addActionListener(AddRemoveParameterListener(table))
        downButtonConstraints = GridBagConstraints()
        downButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        downButtonConstraints.anchor = GridBagConstraints.NORTH
        downButtonConstraints.insets = Insets(0, 0, 5, 5) 
        downButtonConstraints.gridx = 0
        downButtonConstraints.gridy = 3
        self.add(downButton, downButtonConstraints)

        scrollPane = JScrollPane(table)
        scrollPaneConstraints = GridBagConstraints()
        scrollPaneConstraints.gridwidth = 2
        scrollPaneConstraints.gridheight = 5
        scrollPaneConstraints.insets = Insets(0, 0, 5, 5)
        scrollPaneConstraints.anchor = GridBagConstraints.NORTHWEST 
        scrollPaneConstraints.gridx = 1
        scrollPaneConstraints.gridy = 0
        self.add(scrollPane, scrollPaneConstraints)

        self.initParameterColumn(table)
        self.initColumnSizes(table)
    def showStackOverlayWindow(self):
        all = JPanel()
        all.setLayout(MigLayout())

        self.imageIDs = WindowManager.getIDList()
        self.imageNames = []

        if self.imageIDs is None:
            IJ.error("No open images", "Stack Overlay requires at least one image to be already open.")
            return

        for i in self.imageIDs:
            self.imageNames.append(WindowManager.getImage(i).getTitle())

        self.baseImageBox = JComboBox(self.imageNames)
        baseImageBoxLabel = JLabel("Base image")
        self.baseImageBox.setSelectedIndex(0)
        all.add(baseImageBoxLabel)
        all.add(self.baseImageBox, "wrap")

        self.overlayImageBox = JComboBox(self.imageNames)
        overlayImageBoxLabel = JLabel("Overlay image")
        if len(self.imageNames) > 1:
            self.overlayImageBox.setSelectedIndex(1)

        all.add(overlayImageBoxLabel)
        all.add(self.overlayImageBox, "wrap")

        all.add(JSeparator(SwingConstants.HORIZONTAL), "span, wrap")

        overlayStyleFrame = JPanel()
        overlayStyleFrame.setLayout(MigLayout())
        overlayStyleFrame.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Overlay Style"), BorderFactory.createEmptyBorder(5,5,5,5)))

        colorLabel = JLabel("Overlay color")
        self.overlayColorPreviewLabel = JLabel("           ")
        self.overlayColorPreviewLabel.setBorder(BorderFactory.createEmptyBorder(0,0,1,0))
        self.overlayColorPreviewLabel.setOpaque(True)
        self.overlayColorPreviewLabel.setBackground(Color.red)
        self.overlayColor = Color.red
        colorPicker = JColorChooser()
        colorPicker.setPreviewPanel(self.overlayColorPreviewLabel)
        colorButton = JButton("Select color...", actionPerformed=self.showColorChooser)

        opacityLabel = JLabel("Overlay opacity (%)")
        opacitySpinnerModel = SpinnerNumberModel(100, 0, 100, 1)
        self.opacitySpinner = JSpinner(opacitySpinnerModel)

        overlayStyleFrame.add(colorLabel)
        overlayStyleFrame.add(self.overlayColorPreviewLabel)
        overlayStyleFrame.add(colorButton, "wrap")

        overlayStyleFrame.add(opacityLabel)
        overlayStyleFrame.add(self.opacitySpinner, "wrap")
        

        all.add(overlayStyleFrame, "span, wrap")
        
        self.virtualStackCheckbox = JCheckBox("Use Virtual Stack", True)
        all.add(self.virtualStackCheckbox, "span, wrap")

        # TODO: add non-thermonuclear cancel button functionality
        overlayCancelButton = JButton("Cancel", actionPerformed=self.onQuit)
        overlayStartButton = JButton("Overlay images", actionPerformed=self.overlayImages)
        
        all.add(overlayCancelButton, "gapleft push")
        all.add(overlayStartButton, "gapleft push")

        self.frame = JFrame("Stack Overlay")
        self.frame.getContentPane().add(JScrollPane(all))
        self.frame.pack()
        self.frame.setLocationRelativeTo(None)
        self.frame.setVisible(True)
Beispiel #13
0
        stripped_filename = strip_end(old_filename,"_icons")
        stripped_filename = strip_end(stripped_filename,"_run")
        start_file = filepath + "/" + stripped_filename + filetype
        icons_file = filepath + "/" + stripped_filename + "_icons" + filetype
        run_file = filepath + "/" + stripped_filename + "_run" + filetype
    label_panel_location.text = start_file
    #row13b2.text = icons_file
    row11b2.text = run_file
    #os.rename(r'filepath/old_filename.file type',r'file path/NEW file name.file type')

row0 = JPanel()
row0.setLayout(BoxLayout(row0, BoxLayout.X_AXIS))
txt = JTextField(140)
txt.setMaximumSize( txt.getPreferredSize() );
txt.setBorder(BorderFactory.createCompoundBorder(
                   BorderFactory.createLineBorder(Color.red),
                   txt.getBorder()));
label_panel_location = JLabel()
btnpanelLocation = JButton("Set Panel Location", actionPerformed = btnpanelLocation_action)
row0.add(Box.createVerticalGlue())
row0.add(Box.createRigidArea(Dimension(20, 0)))
row0.add(btnpanelLocation)
row0.add(Box.createRigidArea(Dimension(20, 0)))
row0.add(label_panel_location)
row0.add(Box.createRigidArea(Dimension(20, 0)))

row12 = JPanel()
row12.setLayout(BoxLayout(row12, BoxLayout.X_AXIS))
row12b1 = JLabel("Dispatcher System: Modifies panels to produce a running system")
row12b1.add( Box.createHorizontalGlue() );
row12b1.setAlignmentX( row12b1.LEFT_ALIGNMENT )
Beispiel #14
0
    def showStackOverlayWindow(self):
        all = JPanel()
        all.setLayout(MigLayout())

        self.imageIDs = WindowManager.getIDList()
        self.imageNames = []

        if self.imageIDs is None:
            IJ.error(
                "No open images",
                "Stack Overlay requires at least one image to be already open."
            )
            return

        for i in self.imageIDs:
            self.imageNames.append(WindowManager.getImage(i).getTitle())

        self.baseImageBox = JComboBox(self.imageNames)
        baseImageBoxLabel = JLabel("Base image")
        self.baseImageBox.setSelectedIndex(0)
        all.add(baseImageBoxLabel)
        all.add(self.baseImageBox, "wrap")

        self.overlayImageBox = JComboBox(self.imageNames)
        overlayImageBoxLabel = JLabel("Overlay image")
        if len(self.imageNames) > 1:
            self.overlayImageBox.setSelectedIndex(1)

        all.add(overlayImageBoxLabel)
        all.add(self.overlayImageBox, "wrap")

        all.add(JSeparator(SwingConstants.HORIZONTAL), "span, wrap")

        overlayStyleFrame = JPanel()
        overlayStyleFrame.setLayout(MigLayout())
        overlayStyleFrame.setBorder(
            BorderFactory.createCompoundBorder(
                BorderFactory.createTitledBorder("Overlay Style"),
                BorderFactory.createEmptyBorder(5, 5, 5, 5)))

        colorLabel = JLabel("Overlay color")
        self.overlayColorPreviewLabel = JLabel("           ")
        self.overlayColorPreviewLabel.setBorder(
            BorderFactory.createEmptyBorder(0, 0, 1, 0))
        self.overlayColorPreviewLabel.setOpaque(True)
        self.overlayColorPreviewLabel.setBackground(Color.red)
        self.overlayColor = Color.red
        colorPicker = JColorChooser()
        colorPicker.setPreviewPanel(self.overlayColorPreviewLabel)
        colorButton = JButton("Select color...",
                              actionPerformed=self.showColorChooser)

        opacityLabel = JLabel("Overlay opacity (%)")
        opacitySpinnerModel = SpinnerNumberModel(100, 0, 100, 1)
        self.opacitySpinner = JSpinner(opacitySpinnerModel)

        overlayStyleFrame.add(colorLabel)
        overlayStyleFrame.add(self.overlayColorPreviewLabel)
        overlayStyleFrame.add(colorButton, "wrap")

        overlayStyleFrame.add(opacityLabel)
        overlayStyleFrame.add(self.opacitySpinner, "wrap")

        all.add(overlayStyleFrame, "span, wrap")

        self.virtualStackCheckbox = JCheckBox("Use Virtual Stack", True)
        all.add(self.virtualStackCheckbox, "span, wrap")

        # TODO: add non-thermonuclear cancel button functionality
        overlayCancelButton = JButton("Cancel", actionPerformed=self.onQuit)
        overlayStartButton = JButton("Overlay images",
                                     actionPerformed=self.overlayImages)

        all.add(overlayCancelButton, "gapleft push")
        all.add(overlayStartButton, "gapleft push")

        self.frame = JFrame("Stack Overlay")
        self.frame.getContentPane().add(JScrollPane(all))
        self.frame.pack()
        self.frame.setLocationRelativeTo(None)
        self.frame.setVisible(True)
Beispiel #15
0
    def __init__(self, extender, *rows, **kwargs):
        self.extender = extender

        if 'title' in kwargs:
            self.setBorder(
                BorderFactory.createCompoundBorder(
                    BorderFactory.createTitledBorder(kwargs.get('title', '')),
                    BorderFactory.createEmptyBorder(5, 5, 5, 5)))

        self.table = table = JTable(ParameterProcessingRulesTableModel(*rows))
        table.setPreferredScrollableViewportSize(Dimension(500, 70))
        table.setRowSorter(TableRowSorter(table.getModel()))
        table.setFillsViewportHeight(True)

        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [0, 0, 25, 0]
        gridBagLayout.rowHeights = [0, 0, 0, 0]
        gridBagLayout.columnWeights = [0.0, 1.0, 1.0, Double.MIN_VALUE]
        gridBagLayout.rowWeights = [0.0, 0.0, 0.0, Double.MIN_VALUE]
        self.setLayout(gridBagLayout)

        addButton = JButton("Add")
        addButton.addActionListener(AddRemoveParameterListener(table))
        addButtonConstraints = GridBagConstraints()
        addButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        addButtonConstraints.insets = Insets(0, 0, 5, 5)
        addButtonConstraints.gridx = 0
        addButtonConstraints.gridy = 0
        self.add(addButton, addButtonConstraints)

        removeButton = JButton("Remove")
        removeButton.addActionListener(AddRemoveParameterListener(table))
        removeButtonConstraints = GridBagConstraints()
        removeButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        removeButtonConstraints.insets = Insets(0, 0, 5, 5)
        removeButtonConstraints.gridx = 0
        removeButtonConstraints.gridy = 1
        self.add(removeButton, removeButtonConstraints)

        upButton = JButton("Up")
        upButton.addActionListener(AddRemoveParameterListener(table))
        upButtonConstraints = GridBagConstraints()
        upButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        upButtonConstraints.insets = Insets(0, 0, 5, 5)
        upButtonConstraints.gridx = 0
        upButtonConstraints.gridy = 2
        self.add(upButton, upButtonConstraints)

        downButton = JButton("Down")
        downButton.addActionListener(AddRemoveParameterListener(table))
        downButtonConstraints = GridBagConstraints()
        downButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        downButtonConstraints.anchor = GridBagConstraints.NORTH
        downButtonConstraints.insets = Insets(0, 0, 5, 5)
        downButtonConstraints.gridx = 0
        downButtonConstraints.gridy = 3
        self.add(downButton, downButtonConstraints)

        scrollPane = JScrollPane(table)
        scrollPaneConstraints = GridBagConstraints()
        scrollPaneConstraints.gridwidth = 2
        scrollPaneConstraints.gridheight = 5
        scrollPaneConstraints.insets = Insets(0, 0, 5, 5)
        scrollPaneConstraints.anchor = GridBagConstraints.NORTHWEST
        scrollPaneConstraints.gridx = 1
        scrollPaneConstraints.gridy = 0
        self.add(scrollPane, scrollPaneConstraints)

        self.initParameterColumn(table)
        self.initColumnSizes(table)