本文整理汇总了Python中javax.swing.BorderFactory.createTitledBorder方法的典型用法代码示例。如果您正苦于以下问题:Python BorderFactory.createTitledBorder方法的具体用法?Python BorderFactory.createTitledBorder怎么用?Python BorderFactory.createTitledBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.BorderFactory
的用法示例。
在下文中一共展示了BorderFactory.createTitledBorder方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
def __init__(self, cattr):
self.attr = cattr
self.cbox = JColorChooser(self.attr.color)
self.sym_panel = EditSymbolAttr(cattr.sym_prop)
self.thickness_field = JTextField(str(cattr.thickness),2)
self.draw_symbol_box = JCheckBox("Draw Symbol?",cattr.draw_symbol)
self.dps_field = JTextField(str(self.attr.data_per_symbol),2)
self.dash_box = JComboBox(CurveProps.DASH_TYPES.keys())
self.dash_box.setSelectedItem(self.attr.dash_type)
self.dash_box.setBorder(BorderFactory.createTitledBorder("Dash type: (Only JDK2 & Slow!)"))
tpanelx = JPanel()
tpanelx.add(self.thickness_field)
tpanelx.setBorder(BorderFactory.createTitledBorder("curve thickness (integer)"))
tpanely = JPanel()
tpanely.add(self.dps_field)
tpanely.setBorder(BorderFactory.createTitledBorder("data per symbol(integer)"))
tpanel = JPanel();tpanel.setLayout(GridLayout(2,2));
tpanel.add(self.draw_symbol_box); tpanel.add(tpanelx);
tpanel.add(tpanely); tpanel.add(self.dash_box);
panel1 = JPanel()
panel1.setLayout(BorderLayout())
panel1.add(self.cbox,BorderLayout.CENTER)
panel1.add(tpanel, BorderLayout.SOUTH)
panel2 = JPanel()
panel2.setLayout(BorderLayout())
panel2.add(self.sym_panel,BorderLayout.CENTER)
tp1 = JTabbedPane()
tp1.addTab("Curve Attributes",panel1)
tp1.addTab("Symbol Attributes",panel2)
tp1.setSelectedComponent(panel1)
self.setLayout(BorderLayout())
self.add(tp1,BorderLayout.CENTER)
示例2: render
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
def render(self):
'''Render on the frame the login panel with the fields needed to
authenticate with the Asterisk manager.'''
self.layout = GridLayout(0,2)
self.setBorder(BorderFactory.createTitledBorder('Asterisk account information'))
self.hostname = EnhancedTextField('localhost', 15)
self.add(JLabel('Hostname:'))
self.add(self.hostname)
self.username = EnhancedTextField('manager', 15)
self.add(JLabel('Username:'))
self.add(self.username)
self.password = EnhancedPasswordField('pa55word', 15)
self.add(JLabel('Password:'))
self.add(self.password)
self.extension = EnhancedTextField('SIP/John', 15)
self.add(JLabel('Extension:'))
self.add(self.extension)
self.login = JButton('Log in', actionPerformed=self.buttonAction)
self.add(self.login)
self.status = JLabel('Awaiting information...')
self.add(self.status)
示例3: renderMainPanel
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
def renderMainPanel(self):
'''Render on the frame the main panel with a status label'''
self.mainPanel = JPanel(GridLayout(0,2))
self.frame.add(self.mainPanel)
self.mainPanel.setBorder(BorderFactory.createTitledBorder('Application status'))
self.mainPanel.add(JLabel('Status:'))
self.statusLabel = JTextField('Running...', 15)
self.statusLabel.editable = False
self.mainPanel.add(self.statusLabel)
示例4: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
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)
示例5: renderTwitterLoginPanel
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
def renderTwitterLoginPanel(self):
'''Render on the frame the login panel with the fields needed to
authenticate with the Twitter API.'''
self.twitterLoginPanel = JPanel(GridLayout(0,2))
self.frame.add(self.twitterLoginPanel)
self.twitterLoginPanel.setBorder(BorderFactory.createTitledBorder('Twitter account information'))
self.twitterLoginField = extragui.EnhancedTextField('asterisk-jython', 15)
self.twitterLoginPanel.add(JLabel('Username:'))
self.twitterLoginPanel.add(self.twitterLoginField)
self.twitterPasswordField = extragui.EnhancedPasswordField('password', 15)
self.twitterLoginPanel.add(JLabel('Password:'))
self.twitterLoginPanel.add(self.twitterPasswordField)
self.twitterLoginButton = JButton('Log in', actionPerformed=self.loginToTwitter)
self.twitterLoginPanel.add(self.twitterLoginButton)
self.twitterLoginPanel.getRootPane().setDefaultButton(self.twitterLoginButton)
self.twitterLoginStatusLabel = JLabel('Awaiting information...')
self.twitterLoginPanel.add(self.twitterLoginStatusLabel)
示例6: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
def __init__(self):
'''
Constructor
'''
#Create classifiers
#Character classifier
path_to_this_dir = File(str(inspect.getfile( inspect.currentframe() ))).getParent()
character_classifier_file = open(File(path_to_this_dir,"character_classifier.dat").getPath(),'r')
self.character_classifier = CharacterClassifier(from_string_string=character_classifier_file.read())
character_classifier_file.close()
#Word classifier
word_classifier_file = open(File(path_to_this_dir,"word_classifier.dat").getPath(),'r')
self.word_classifier= WordClassifier(from_string_string=word_classifier_file.read())
word_classifier_file.close()
#Set up window
self.setTitle("HandReco Writer")
self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
self.setLocationRelativeTo(None)
self.setLayout(BorderLayout())
#Set up menu
menu_bar = JMenuBar()
info_menu = JMenu("Info")
def instructions(event):
instr = '''
The program can just recognise capital English characters.
See Info -> Available Words... for available word corrections.
Good Luck with the writing!'''
JOptionPane.showMessageDialog(self, instr,
"Instructions",
JOptionPane.INFORMATION_MESSAGE)
instructions_menu_item = JMenuItem("Instructions...",actionPerformed=instructions)
info_menu.add(instructions_menu_item)
def word_corrections(event):
words_string = ""
for word in self.word_classifier.words:
words_string = words_string + word.upper() + "\n"
text = "The words that can be corrected are:\n\n" +words_string
dialog = JOptionPane(text,
JOptionPane.INFORMATION_MESSAGE)
dialog_wrapper = JDialog(self,"Available Words",False)
dialog_wrapper.setContentPane(dialog)
dialog_wrapper.pack()
dialog_wrapper.setVisible(True)
word_corrections_menu_item = JMenuItem("Available Words...",actionPerformed=word_corrections)
info_menu.add(word_corrections_menu_item)
menu_bar.add(info_menu)
self.setJMenuBar(menu_bar)
#Input panel
input_panel = JPanel()
input_panel.setLayout(BoxLayout(input_panel, BoxLayout.X_AXIS))
input_panel.setBorder(BorderFactory.createTitledBorder("Input"))
self.paint_area = PaintArea(100,100)
input_panel.add(self.paint_area)
input_options_panel = JPanel()
input_options_panel.setLayout(BoxLayout(input_options_panel, BoxLayout.Y_AXIS))
#Write Char
write_char_panel = JPanel(BorderLayout())
def write_char(event):
char = self.character_classifier.classify_image(self.paint_area.image())
self.text_area.setText(self.text_area.getText() + char)
self.paint_area.clear()
write_char_panel.add(JButton("Write Char", actionPerformed=write_char), BorderLayout.NORTH)
input_options_panel.add(write_char_panel)
#Space and Correct
space_and_correct_panel = JPanel(BorderLayout())
def space_and_correct(event):
text = self.text_area.getText()
words = text.split(" ")
string = words[-1]
try:
word = self.word_classifier.classify(string.lower())
words[-1] = word.upper()
except:
JOptionPane.showMessageDialog(self, "Have you entered a character which is not in the alphabet?",
"Could not Correct",
JOptionPane.ERROR_MESSAGE)
self.text_area.setText(text + " ")
return
newText = ""
for w in words:
newText = newText + w + " "
self.text_area.setText(newText)
space_and_correct_panel.add(JButton("Space and Correct", actionPerformed=space_and_correct), BorderLayout.NORTH)
input_options_panel.add(space_and_correct_panel)
#Space
space_panel = JPanel(BorderLayout())
def space(event):
self.text_area.setText(self.text_area.getText() + " ")
space_panel.add(JButton("Space", actionPerformed=space), BorderLayout.NORTH)
input_options_panel.add(space_panel)
#Clear Input Area
clear_input_area_panel = JPanel(BorderLayout())
def clear(event):
self.paint_area.clear()
clear_input_area_panel.add(JButton("Clear Input Area", actionPerformed=clear), BorderLayout.NORTH)
input_options_panel.add(clear_input_area_panel)
input_panel.add(input_options_panel)
self.add(input_panel, BorderLayout.NORTH)
text_area_panel = JPanel()
#.........这里部分代码省略.........
示例7: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
def __init__(self, pP):
'''
Constructor
'''
self.pP = pP
self.annotationType = self.pP.getAnnotationType()
self.setTitle("Random Picture Picker")
#annotation Panel
annoPanel = JPanel()
annoPanel.setBorder(BorderFactory.createTitledBorder("Annotations"))
annoPLayout = GroupLayout(annoPanel)
annoPanel.setLayout(annoPLayout)
annoPLayout.setAutoCreateContainerGaps(True)
annoPLayout.setAutoCreateGaps(True)
# dynamic creation of annotation panel
# yesNoIgnore, int, number, list
if len(self.pP.getAnnotationType()) == 1:
self.annoField = JTextField("", 16)
annoPLayout.setHorizontalGroup(annoPLayout.createParallelGroup().addComponent(self.annoField))
annoPLayout.setVerticalGroup(annoPLayout.createSequentialGroup().addComponent(self.annoField))
elif len(self.pP.getAnnotationType()) > 1:
choices = pP.getAnnotationType()
print "choices", choices
choiceBtns = []
self.annoField = ButtonGroup()
for c in choices:
Btn = JRadioButton(c, actionCommand=c)
self.annoField.add(Btn)
choiceBtns.append(Btn)
h = annoPLayout.createParallelGroup()
for b in choiceBtns:
h.addComponent(b)
annoPLayout.setHorizontalGroup(h)
v = annoPLayout.createSequentialGroup()
for b in choiceBtns:
v.addComponent(b)
annoPLayout.setVerticalGroup(v)
# Control Panel
ctrlPanel = JPanel()
ctrlPLayout = GroupLayout(ctrlPanel, autoCreateContainerGaps=True, autoCreateGaps=True)
ctrlPanel.setLayout(ctrlPLayout)
nextImgButton = JButton("Next >", actionPerformed=self.nextPicture)
prevImgButton = JButton("< Prev", actionPerformed=self.pP.prevPicture)
quitButton = JButton("Quit", actionPerformed=self.exit)
ctrlPLayout.setHorizontalGroup(ctrlPLayout.createParallelGroup(GroupLayout.Alignment.CENTER)
.addGroup(ctrlPLayout.createSequentialGroup()
.addComponent(prevImgButton)
.addComponent(nextImgButton))
.addComponent(quitButton))
ctrlPLayout.setVerticalGroup(ctrlPLayout.createSequentialGroup()
.addGroup(ctrlPLayout.createParallelGroup()
.addComponent(prevImgButton)
.addComponent(nextImgButton))
.addComponent(quitButton))
ctrlPLayout.linkSize(SwingConstants.HORIZONTAL, quitButton)
statusPanel = JPanel() # contains status information: progress bar
self.progressBar = JProgressBar()
self.progressBar.setStringPainted(True)
self.progressBar.setValue(0)
statusPanel.add(self.progressBar)
#MainLayout
mainLayout = GroupLayout(self.getContentPane())
self.getContentPane().setLayout(mainLayout)
mainLayout.setHorizontalGroup(mainLayout.createParallelGroup(GroupLayout.Alignment.CENTER)
.addComponent(annoPanel)
.addComponent(ctrlPanel)
.addComponent(statusPanel)
)
mainLayout.setVerticalGroup(mainLayout.createSequentialGroup()
.addComponent(annoPanel)
.addComponent(ctrlPanel)
.addComponent(statusPanel)
)
mainLayout.linkSize(SwingConstants.HORIZONTAL, annoPanel, ctrlPanel, statusPanel)
self.pack()
self.setVisible(True)
self.pP.nextPicture()
示例8: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
def __init__(self, imgData):
n = imgData.size()
win = JFrame("Point Marker Panel")
win.setPreferredSize(Dimension(350, 590))
win.setSize(win.getPreferredSize())
pan = JPanel()
pan.setLayout(BoxLayout(pan, BoxLayout.Y_AXIS))
win.getContentPane().add(pan)
progressPanel = JPanel()
progressPanel.setLayout(BoxLayout(progressPanel, BoxLayout.Y_AXIS))
positionBar = JProgressBar()
positionBar.setMinimum(0)
positionBar.setMaximum(n)
positionBar.setStringPainted(True)
progressPanel.add(Box.createGlue())
progressPanel.add(positionBar)
progressBar = JProgressBar()
progressBar.setMinimum(0)
progressBar.setMaximum(n)
progressBar.setStringPainted(True)
progressPanel.add(progressBar)
progressPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10))
pan.add(progressPanel)
pan.add(Box.createRigidArea(Dimension(5,5)))
savePanel = JPanel()
savePanel.setLayout(BoxLayout(savePanel, BoxLayout.Y_AXIS))
saveMessageLabel = JLabel("<html><u>Save Often</u></html>")
savePanel.add(saveMessageLabel)
savePanel.setAlignmentX(Component.CENTER_ALIGNMENT)
savePanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10))
pan.add(savePanel)
# pan.add(saveMessageLabel)
pan.add(Box.createRigidArea(Dimension(5,5)))
calPanel = JPanel()
calPanel.setLayout(BoxLayout(calPanel, BoxLayout.Y_AXIS))
calPanelIn = JPanel()
calPanelIn.setLayout(BoxLayout(calPanelIn, BoxLayout.X_AXIS))
pixelSizeText = JTextField(12)
pixelSizeText.setHorizontalAlignment(JTextField.RIGHT)
# pixelSizeText.setMaximumSize(pixelSizeText.getPreferredSize())
unitText = JTextField(10)
# unitText.setMaximumSize(unitText.getPreferredSize())
pixelSizeText.setText("Enter Pixel Size Here")
calPanelIn.add(pixelSizeText)
unitText.setText("Unit")
calPanelIn.add(unitText)
calPanelIn.setAlignmentX(Component.CENTER_ALIGNMENT)
calPanelIn.setBorder(BorderFactory.createTitledBorder("Custom Calibration"))
calPanel.add(calPanelIn)
calPanelIn.setAlignmentX(Component.CENTER_ALIGNMENT)
calPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10))
pan.add(calPanel)
pan.add(Box.createRigidArea(Dimension(5,5)))
helpPanel = JPanel()
helpPanel.setLayout(BoxLayout(helpPanel, BoxLayout.Y_AXIS))
helpLable = JLabel("<html><ul>\
<li>Focus on Image Window</li>\
<li>Select multi-point Tool</li>\
<li>Click to Draw Points</li>\
<li>Drag to Move Points</li>\
<li>\"Alt\" + Click to Erase Points</li>\
<li>Optional: Customize Calibration Above\
and Refresh Images\
(won't be written to files)</li>\
</html>")
helpLable.setBorder(BorderFactory.createTitledBorder("Usage"))
keyTagOpen = "<span style=\"background-color: #FFFFFF\"><b><kbd>"
keyTagClose = "</kbd></b></span>"
keyLable = JLabel("<html><ul>\
<li>Next Image --- " + keyTagOpen + "<" + \
keyTagClose + "</li>\
<li>Previous Image --- " + keyTagOpen + ">" + \
keyTagClose + "</li>\
<li>Save --- " + keyTagOpen + "`" + keyTagClose + \
" (upper-left to TAB key)</li>\
<li>Next Unmarked Image --- " + keyTagOpen + \
"TAB" + keyTagClose + "</li></ul>\
</html>")
keyLable.setBorder(BorderFactory.createTitledBorder("Keyboard Shortcuts"))
helpPanel.add(helpLable)
helpPanel.add(keyLable)
helpPanel.setAlignmentX(Component.CENTER_ALIGNMENT)
helpPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10))
pan.add(helpPanel)
# pan.add(Box.createRigidArea(Dimension(0, 10)))
infoPanel = JPanel()
infoPanel.setLayout(BoxLayout(infoPanel, BoxLayout.Y_AXIS))
infoLabel = JLabel()
infoLabel.setBorder(BorderFactory.createTitledBorder("Project Info"))
infoPanel.add(infoLabel)
infoPanel.setAlignmentX(Component.CENTER_ALIGNMENT)
infoPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10))
pan.add(infoPanel)
#.........这里部分代码省略.........
示例9: run
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
def run(self, cells, path) :
self.__cells=cells
cells.sort()
self.__cells.sort()
self.__path=path
if len(cells) <= 6 :
cols=len(cells)
rows=1
else :
cols=6
rows=int(len(cells)/6)+1
#print "cols", cols, "rows", rows
self.setFont(awt.Font("Courrier", 1, 10))
#self.size=(max(200*cols, 1100), max(70*rows, 300))
self.size=(max(150*cols, 800), max(50*rows, 250))
line = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)
self.contentPane.layout = awt.BorderLayout()
self.__display = swing.JTextField(preferredSize=(400, 30), horizontalAlignment=swing.SwingConstants.LEFT)
self.__setDisplay()
northpanel=swing.JPanel(awt.FlowLayout(awt.FlowLayout.LEFT))
northpanel.setBorder(line)
#northpanel.add(self.__display, awt.BorderLayout.NORTH)
northpanel.add(self.__display)
selectall = swing.JButton("select ALL", size=(100, 70), actionPerformed=self.__selectall)
#northpanel.add(selectall, awt.BorderLayout.WEST)
northpanel.add(selectall)
selectnone = swing.JButton("select NONE", size=(100, 70), actionPerformed=self.__selectnone)
#northpanel.add(selectnone, awt.BorderLayout.EAST)
northpanel.add(selectnone)
mem = swing.JButton("Memorize", size=(100, 70), actionPerformed= self.__memorize)
northpanel.add(mem)
recall = swing.JButton("Recall", size=(100, 70), actionPerformed=self.__recall)
northpanel.add(recall)
southpanel=swing.JPanel(awt.FlowLayout(awt.FlowLayout.RIGHT))
southpanel.setBorder(line)
self.__label=swing.JLabel("validate selection with ok")
southpanel.add(self.__label)
ok = swing.JButton("ok", size=(100, 70), actionPerformed=self.__ok)
southpanel.add(ok)
close = swing.JButton("close", size=(100, 70), actionPerformed=self.__close)
southpanel.add(close)
westpanel=swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER), preferredSize=(150, 200))
westpanel.setBorder(line)
show = swing.JButton("show overlay", size=(100, 70), actionPerformed=self.__show)
westpanel.add(show)
hide = swing.JButton("hide overlay", size=(100, 70), actionPerformed=self.__hide)
westpanel.add(hide)
allframes = swing.JButton("show all", size=(100, 70), actionPerformed=self.__showall)
westpanel.add(allframes)
oneframe = swing.JButton("show one frame", size=(100, 70), actionPerformed=self.__showone)
westpanel.add(oneframe)
reset = swing.JButton("reset", size=(100, 70), actionPerformed=self.__reset)
westpanel.add(reset)
title = BorderFactory.createTitledBorder("Edit Cells")
title.setTitleJustification(TitledBorder.CENTER)
eastpanel = swing.JPanel(awt.FlowLayout(awt.FlowLayout.CENTER), preferredSize=(130, 200))
eastpanel.setBorder(title)
split = swing.JButton("split", size=(100, 70), actionPerformed=self.__split)
eastpanel.add(split)
grid = awt.GridLayout()
grid.setRows(rows)
checkpanel=swing.JPanel(grid)
checkpanel.setFont(awt.Font("Courrier", 1, 10))
self.__boxes=[swing.JCheckBox(actionPerformed=self.__boxaction) for i in range(len(cells))]
for b in self.__boxes : b.setFont(awt.Font("Courrier", 1, 10))
#self.__mem=[True for i in range(len(cells))]
for i in range(len(self.__boxes)) :
self.__dictBox[cells[i]]=(cells[i], self.__boxes[i])
for i in range(len(self.__boxes)) :
self.__boxes[i].setText(str(cells[i]))
self.__boxes[i].setSelected(True)
checkpanel.add(self.__boxes[i])
for i in range(rows*cols-len(self.__boxes)) : checkpanel.add(awt.Label(""))
self.contentPane.add(northpanel, awt.BorderLayout.NORTH)
self.contentPane.add(checkpanel, awt.BorderLayout.CENTER)
self.contentPane.add(westpanel, awt.BorderLayout.WEST)
self.contentPane.add(eastpanel, awt.BorderLayout.EAST)
self.contentPane.add(southpanel, awt.BorderLayout.SOUTH)
self.contentPane.setFont(awt.Font("Courrier", 1, 10))
self.__rm = RoiManager.getInstance()
if (self.__rm==None): self.__rm = RoiManager()
self.__rm.runCommand("reset")
listfilescells=[]
listfilescells.extend(glob.glob(path+"*.zip"))
#.........这里部分代码省略.........
示例10: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
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)
示例11: showStackOverlayWindow
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
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)
示例12: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
def __init__(self, parent, title, app):
from javax.swing import JCheckBox, JRadioButton, ButtonGroup
self.app = app
border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
self.getContentPane().setBorder(border)
self.getContentPane().setLayout(BorderLayout(0, 5))
self.tabbedPane = JTabbedPane()
#1 Tab: general
panel1 = JPanel()
panel1.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7))
panel1.setLayout(BoxLayout(panel1, BoxLayout.PAGE_AXIS))
#Checkbutton to enable/disable update check when script starts
self.updateCBtn = JCheckBox(self.app.strings.getString("updateCBtn"))
self.updateCBtn.setToolTipText(self.app.strings.getString("updateCBtn_tooltip"))
#Download tools
downloadBtn = JButton(self.app.strings.getString("updatesBtn"),
ImageProvider.get("dialogs", "refresh"),
actionPerformed=self.on_downloadBtn_clicked)
downloadBtn.setToolTipText(self.app.strings.getString("updatesBtn_tooltip"))
#Checkbuttons for enabling/disabling tools
toolsPanel = JPanel(BorderLayout(0, 5))
title = self.app.strings.getString("enable_disable_tools")
toolsPanel.setBorder(BorderFactory.createTitledBorder(title))
infoLbl = JLabel(self.app.strings.getString("JOSM_restart_warning"))
infoLbl.setFont(infoLbl.getFont().deriveFont(Font.ITALIC))
toolsPanel.add(infoLbl, BorderLayout.PAGE_START)
toolsStatusPane = JPanel(GridLayout(len(self.app.realTools), 0))
self.toolsCBtns = []
for tool in self.app.realTools:
toolCBtn = JCheckBox()
toolCBtn.addItemListener(self)
toolLbl = JLabel(tool.title, tool.bigIcon, JLabel.LEFT)
self.toolsCBtns.append(toolCBtn)
toolPane = JPanel()
toolPane.setLayout(BoxLayout(toolPane, BoxLayout.X_AXIS))
toolPane.add(toolCBtn)
toolPane.add(toolLbl)
toolsStatusPane.add(toolPane)
toolsPanel.add(toolsStatusPane, BorderLayout.CENTER)
#Radiobuttons for enabling/disabling layers when a new one
#is added
layersPanel = JPanel(GridLayout(0, 1))
title = self.app.strings.getString("errors_layers_manager")
layersPanel.setBorder(BorderFactory.createTitledBorder(title))
errorLayersLbl = JLabel(self.app.strings.getString("errors_layers_info"))
errorLayersLbl.setFont(errorLayersLbl.getFont().deriveFont(Font.ITALIC))
layersPanel.add(errorLayersLbl)
self.layersRBtns = {}
group = ButtonGroup()
for mode in self.app.layersModes:
layerRBtn = JRadioButton(self.app.strings.getString("%s" % mode))
group.add(layerRBtn)
layersPanel.add(layerRBtn)
self.layersRBtns[mode] = layerRBtn
#Max number of errors text field
self.maxErrorsNumberTextField = JTextField()
self.maxErrorsNumberTextField.setToolTipText(self.app.strings.getString("maxErrorsNumberTextField_tooltip"))
self.maxErrorsNumberTFieldDefaultBorder = self.maxErrorsNumberTextField.getBorder()
self.maxErrorsNumberTextField.getDocument().addDocumentListener(ErrNumTextListener(self))
#layout
self.updateCBtn.setAlignmentX(Component.LEFT_ALIGNMENT)
panel1.add(self.updateCBtn)
panel1.add(Box.createRigidArea(Dimension(0, 15)))
downloadBtn.setAlignmentX(Component.LEFT_ALIGNMENT)
panel1.add(downloadBtn)
panel1.add(Box.createRigidArea(Dimension(0, 15)))
toolsPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
panel1.add(toolsPanel)
panel1.add(Box.createRigidArea(Dimension(0, 15)))
layersPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
panel1.add(layersPanel)
panel1.add(Box.createRigidArea(Dimension(0, 15)))
maxErrP = JPanel(BorderLayout(5, 0))
maxErrP.add(JLabel(self.app.strings.getString("max_errors_number")), BorderLayout.LINE_START)
maxErrP.add(self.maxErrorsNumberTextField, BorderLayout.CENTER)
p = JPanel(BorderLayout())
p.add(maxErrP, BorderLayout.PAGE_START)
p.setAlignmentX(Component.LEFT_ALIGNMENT)
panel1.add(p)
self.tabbedPane.addTab(self.app.strings.getString("tab_1_title"),
None,
panel1,
None)
#2 Tab: favourite zones
panel2 = JPanel(BorderLayout(5, 15))
panel2.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7))
#status
topPanel = JPanel()
#.........这里部分代码省略.........
示例13: initUI
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createTitledBorder [as 别名]
def initUI(self):
inputPanel = JPanel()
inputPanel.setBorder(BorderFactory.createTitledBorder("Where are your control and treament images?"))
inputLayout = GroupLayout(inputPanel, autoCreateContainerGaps=True, autoCreateGaps=True)
inputPanel.setLayout(inputLayout)
annotatePanel = JPanel()
annotatePanel.setBorder(BorderFactory.createTitledBorder("How do you want to annotate your data?"))
anLayout = GroupLayout(annotatePanel, autoCreateContainerGaps=True, autoCreateGaps=True)
annotatePanel.setLayout(anLayout)
exportPanel = JPanel()
exportPanel.setBorder(BorderFactory.createTitledBorder("Where do you want to export your data"))
exportLayout = GroupLayout(exportPanel, autoCreateContainerGaps=True, autoCreateGaps=True)
exportPanel.setLayout(exportLayout)
btnPanel = JPanel()
btnLayout = GroupLayout(btnPanel, autoCreateContainerGaps=True, autoCreateGaps=True)
btnPanel.setLayout(btnLayout)
layout = GroupLayout(self.getContentPane(), autoCreateContainerGaps=True, autoCreateGaps=True)
self.getContentPane().setLayout(layout)
self.setModalityType(ModalityType.APPLICATION_MODAL)
self.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE)# JFrame.EXIT_ON_CLOSE)
# definition of elements
# labels
cPathLabel = JLabel("Control Path:")
tPathLabel = JLabel("Treatment Path:")
exPathLabel = JLabel("Save Results in:")
#textfields
self.cPathField = JTextField("/Users/schiklen/DotData/131118_dummy/131118_2926/cutout/", 16)
self.tPathField = JTextField("/Users/schiklen/DotData/131118_dummy/131118_2926/cutout/", 16)
self.exPathField = JTextField("/Users/schiklen/DotData/131118_dummy/131118_2926/cutout/", 16)
#Radiobuttons
yesNoRButton = JRadioButton("Yes / No / Ignore", selected=True, actionCommand="yesNoIgnore", actionPerformed=self.setAnnotationTypeDialog)
intRButton = JRadioButton("Integer", actionCommand="int", actionPerformed=self.setAnnotationTypeDialog)
nRButton = JRadioButton("Number", actionCommand="float", actionPerformed=self.setAnnotationTypeDialog)
listRButton = JRadioButton("From List...", actionCommand="list", actionPerformed=self.openListDialog)
self.rBGroup = ButtonGroup()
self.rBGroup.add(yesNoRButton)
self.rBGroup.add(intRButton)
self.rBGroup.add(nRButton)
self.rBGroup.add(listRButton)
#self.customListButton = JButton("Custom List...", actionPerformed=self.makeCustomList, enabled=0)
#buttons
cPathButton = JButton("Browse...", actionPerformed=self.browseC) # lambda on fieldvalue
tPathButton = JButton("Browse...", actionPerformed=self.browseT) # lambda on fieldvalue
exPathButton = JButton("Browse...", actionPerformed=self.browseE)
OKButton = JButton("OK", actionPerformed=self.okayEvent)
CancelButton = JButton("Cancel", actionPerformed=self.cancel)
'''General ContentPane Layout'''
layout.setHorizontalGroup(layout.createParallelGroup()
.addComponent(inputPanel)
.addComponent(annotatePanel)
.addComponent(exportPanel)
.addComponent(btnPanel)
)
layout.linkSize(SwingConstants.HORIZONTAL, inputPanel, annotatePanel, exportPanel, btnPanel)
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(inputPanel)
.addComponent(annotatePanel)
.addComponent(exportPanel)
.addComponent(btnPanel)
)
''' Input panel Layout '''
inputLayout.setHorizontalGroup(inputLayout.createSequentialGroup()
.addGroup(inputLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(cPathLabel)
.addComponent(tPathLabel))
.addGroup(inputLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(self.cPathField)
.addComponent(self.tPathField))
.addGroup(inputLayout.createParallelGroup()
.addComponent(cPathButton)
.addComponent(tPathButton))
)
inputLayout.setVerticalGroup(inputLayout.createSequentialGroup()
.addGroup(inputLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(cPathLabel)
.addComponent(self.cPathField)
.addComponent(cPathButton))
.addGroup(inputLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(tPathLabel)
.addComponent(self.tPathField)
.addComponent(tPathButton))
)
'''Annotate panel layout'''
anLayout.setHorizontalGroup(anLayout.createParallelGroup()
.addComponent(yesNoRButton)
#.........这里部分代码省略.........