本文整理汇总了Python中javax.swing.BorderFactory.createLoweredBevelBorder方法的典型用法代码示例。如果您正苦于以下问题:Python BorderFactory.createLoweredBevelBorder方法的具体用法?Python BorderFactory.createLoweredBevelBorder怎么用?Python BorderFactory.createLoweredBevelBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.BorderFactory
的用法示例。
在下文中一共展示了BorderFactory.createLoweredBevelBorder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createLoweredBevelBorder [as 别名]
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
示例2: initUI
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createLoweredBevelBorder [as 别名]
def initUI(self):
'''Initial UI and Widget creation takes place here!
'''
self.setContentPane = JPanel()
#self.setDefaultLookAndFeelDecorated(True)
# Borders
foreground_colour = Color(30,57,68)
background_colour = Color(247,246,242)
window_background = Color(145,190,210)
self.border = BorderFactory.createLoweredBevelBorder()
self.border2 = BorderFactory.createLineBorder(foreground_colour, 1, True)
# Fonts
self.entry_font= Font("Ubuntu Light", Font.BOLD, 20)
self.label_font= Font("Ubuntu Light", Font.BOLD, 17)
self.btn_font=Font("Ubuntu Light", Font.BOLD, 15)
# Layout start
layout=GroupLayout(self.getContentPane())
self.getContentPane().setLayout(layout)
layout.setAutoCreateGaps(True)
layout.setAutoCreateContainerGaps(True)
self.setPreferredSize(Dimension(300, 150))
# Create the labels
user_label= JLabel(" Username : ",JLabel.LEFT, font=self.label_font)
server_label=JLabel(" Server : ", JLabel.LEFT, font=self.label_font)
# Colours
user_label.setForeground(foreground_colour)
server_label.setForeground(foreground_colour)
# Create the text entries
self.username=JTextField(actionPerformed=self.continueEvent, border=self.border2, font = self.entry_font)
self.server=JTextField(actionPerformed=self.continueEvent, border=self.border2, font = self.entry_font)
# Colours
self.username.setBackground(background_colour)
self.server.setBackground(background_colour)
self.username.setForeground(foreground_colour)
self.server.setForeground(foreground_colour)
# Allow editable
self.username.setEditable(True)
self.server.setEditable(True)
# Create the buttons
quit_btn=JButton(" Quit! ", actionPerformed=self.closeEvent, border=self.border2, font=self.btn_font)
go_btn=JButton(" Go! ", actionPerformed=self.continueEvent, border=self.border2, font=self.btn_font)
# Colours
quit_btn.setBackground(background_colour)
go_btn.setBackground(background_colour)
quit_btn.setForeground(foreground_colour)
go_btn.setForeground(foreground_colour)
# Setting up the horizontal groups parameters
layout.setHorizontalGroup(layout.createSequentialGroup()
# Left side
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(user_label)
.addComponent(server_label))
# Right side
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
.addComponent(self.username)
.addComponent(self.server)
.addGroup(layout.createSequentialGroup()
.addComponent(quit_btn)
.addComponent(go_btn)))
)
# Setting up Vertical Groups
layout.setVerticalGroup(layout.createSequentialGroup()
# Top group
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
.addComponent(user_label)
.addComponent(self.username))
# Middle group
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
.addComponent(server_label)
.addComponent(self.server))
# Bottom group
.addGroup(layout.createParallelGroup()
.addComponent(quit_btn)
.addComponent(go_btn))
)
# Finalise the GUI
layout.linkSize(SwingConstants.HORIZONTAL, [quit_btn,go_btn])
self.getContentPane().setBackground(window_background)
self.pack()
self.setTitle('Chat Login')
self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
self.setLocationRelativeTo(None)
self.setVisible(True)