本文整理了Java中javax.swing.JTextField.setSize()
方法的一些代码示例,展示了JTextField.setSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.setSize()
方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:setSize
暂无
代码示例来源:origin: magefree/mage
public void changeGUISize(Font font) {
txtConversation.setFont(font);
txtMessage.setFont(font);
if (jScrollPaneTxt != null) {
jScrollPaneTxt.setFont(font);
jScrollPaneTxt.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPaneTxt.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
}
int height = 30;
if (font.getSize() > 20) {
height = 30 + Math.min(font.getSize() - 10, 30);
}
txtMessage.setMinimumSize(new Dimension(20, height));
txtMessage.setMaximumSize(new Dimension(txtMessage.getWidth(), height));
txtMessage.setPreferredSize(new Dimension(txtMessage.getWidth(), height));
txtMessage.setSize(new Dimension(txtMessage.getWidth(), height));
if (connectedChat != null) {
connectedChat.changeGUISize(font);
}
}
代码示例来源:origin: stackoverflow.com
public static Component textbox(String x){
JPanel panel = new JPanel(new BorderLayout());
JLabel lbltAm= new JLabel(x);
JTextField tftAm = new JTextField(20);
lbltAm.setLabelFor(tftAm);
lbltAm.setFont(new Font("Serif", Font.PLAIN, 18));
tftAm.setSize(10, 10);
panel.add(lbltAm, BorderLayout.NORTH);
panel.add(tftAm, BorderLayout.CENTER);
return panel;
}
代码示例来源:origin: stackoverflow.com
JTextField fname = new JTextField(80);
fname.setBounds( 100, 100, 150, 20 );
fname.setSize(200,30);
return fname;
代码示例来源:origin: stackoverflow.com
public class Goodsin extends JFrame{
public static void main(String[] args) {
Goodsin ui = new Goodsin();
JTextField item1 = new JTextField(10);
JButton btn1 = new JButton("Look up Barcode");
JPanel centralPanel = new JPanel(new FlowLayout());
centralPanel.add(item1);
centralPanel.add(btn1);
item1.setSize(80, 30);
btn1.setSize(80, 30);
ui.add(centralPanel);
ui.pack();
ui.setVisible(true);
}
}
代码示例来源:origin: nl.cloudfarming.client/util-swing
@Override
public void componentResized(ComponentEvent e) {
Dimension newSize = getSize();
label.setSize(new Dimension(newSize.width, newSize.height-4));
textField.setSize(newSize);
}
代码示例来源:origin: stackoverflow.com
JTextField textField = new JTextField(2);
textField.setSize( textField.getPreferredSize() );
textField.setLocation( mouseEvent.getPoint() );
panel.add( textField );
panel.repaint();
代码示例来源:origin: MrCrayfish/ModelCreator
public static void initIncrementableField(JTextField field, Font defaultFont)
{
field.setSize(new Dimension(62, 30));
field.setFont(defaultFont);
field.setHorizontalAlignment(JTextField.CENTER);
}
代码示例来源:origin: eu.agrosense.client/util-swing
@Override
public void componentResized(ComponentEvent e) {
Dimension newSize = getSize();
label.setSize(new Dimension(newSize.width, newSize.height-4));
textField.setSize(newSize);
}
代码示例来源:origin: stackoverflow.com
quiz_1 = new JTextField(8);
panelForTextFields.add(quiz_1);
quiz_2 = new JTextField(8);
panelForTextFields.add(quiz_2);
quiz_3 = new JTextField(8);
panelForTextFields.add(quiz_3);
quiz_4 = new JTextField(8);
panelForTextFields.add(quiz_4);
quiz_5 = new JTextField(8);
panelForTextFields.add(quiz_5);
quiz_6 = new JTextField(8);
panelForTextFields.add(quiz_6);
quiz_7 = new JTextField(8);
panelForTextFields.add(quiz_7);
list.add(quiz_1);
list.add(quiz_2);
list.add(quiz_3);
list.add(quiz_4);
list.add(quiz_5);
list.add(quiz_6);
list.add(quiz_7);
for(int k = 0; k<list.size(); k++){
JTextField f = list.get(k);
f.setLocation(0, k*60);
f.setSize(100, 30);
}
final int GAP = 40;
panelForTextFields.setSize(100, 6*( quiz_1.getHeight() + GAP));
代码示例来源:origin: stackoverflow.com
public JPanel createContentPane() {
buttonPanel = new JPanel();
buttonPanel.setLayout(null);
buttonPanel.setLocation(10, 50);
buttonPanel.setSize(1370, 770);
JButton Button1 = new JButton("Button 1");
Button1.setLocation(0, 0);
Button1.setSize(120, 30);
buttonPanel.add(Button1);
JTextField a = new JTextField(20);
a.setLocation(125, 0);
a.setSize(120, 30);
buttonPanel.add(a);
return buttonPanel;
}
代码示例来源:origin: edu.illinois.cs.cogcomp/DatalessClassification
public View(Controller controller){
window = new JFrame("DatalessHC");
window.setSize(800, 600);
myPanel = new JPanel();
myPanel.setPreferredSize(new Dimension(400,400));
myPanel.setLayout(null);
JButton simple_esa=new JButton("Simple ESA");
simple_esa.setBounds(30,50,150,30);
simple_esa.addActionListener(simple_esa(controller));
myPanel.add(simple_esa);
JButton classify=new JButton("Text Classification");
classify.setBounds(30,100,150,30);
classify.addActionListener(classify(controller));
myPanel.add(classify);
word = new JTextField("Enter Single Word");
word.setSize(200,30);
word.setLocation(200, 50);
myPanel.add(word);
window.setContentPane(myPanel);
window.setVisible(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
代码示例来源:origin: org.jbpm/jbpm-examples
nameTextField.setSize(new Dimension(80, 20));
c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
actorsTextField.setSize(new Dimension(80, 20));
c = new GridBagConstraints();
c.gridy = 1;
groupsTextField.setSize(new Dimension(80, 20));
c = new GridBagConstraints();
c.gridy = 2;
代码示例来源:origin: edu.stanford.protege/org.protege.ontograf
searchField.setSize(new Dimension(300, 22));
searchField.setPreferredSize(new Dimension(300, 22));
searchField.setFocusable(true);
代码示例来源:origin: net.sf.taverna.t2.activities/rshell-activity-ui
hostnameField.setSize(dimension);
hostnameLabel.setSize(dimension);
hostnameLabel.setLabelFor(hostnameField);
portField.setSize(dimension);
portLabel.setSize(dimension);
portLabel.setLabelFor(portField);
usernameField.setSize(dimension);
usernameLabel.setSize(dimension);
usernameLabel.setLabelFor(usernameField);
passwordField.setSize(dimension);
passwordLabel.setSize(dimension);
passwordLabel.setLabelFor(passwordField);
代码示例来源:origin: net.sf.taverna.t2.ui-activities/rshell-activity-ui
hostnameField.setSize(dimension);
hostnameLabel.setSize(dimension);
hostnameLabel.setLabelFor(hostnameField);
portField.setSize(dimension);
portLabel.setSize(dimension);
portLabel.setLabelFor(portField);
代码示例来源:origin: org.apache.directory/com.springsource.org.apache.directory.server.core
keyText.setMaximumSize( new java.awt.Dimension( 130, 20 ) );
keyText.setFont( new java.awt.Font( "SansSerif", java.awt.Font.PLAIN, 14 ) );
keyText.setSize( new java.awt.Dimension( 130, 20 ) );
jLabel2.setText( "Cursor Type:" );
代码示例来源:origin: org.apache.directory.server/apacheds-xdbm-tools
keyText.setMaximumSize( new java.awt.Dimension( 130, 20 ) );
keyText.setFont( new java.awt.Font( "SansSerif", java.awt.Font.PLAIN, 14 ) );
keyText.setSize( new java.awt.Dimension( 130, 20 ) );
jLabel2.setText( "Cursor Type:" );
代码示例来源:origin: org.apache.directory.server/apacheds-xdbm-tools
keyText.setMaximumSize( new java.awt.Dimension( 130, 20 ) );
keyText.setFont( new java.awt.Font( "SansSerif", java.awt.Font.PLAIN, 14 ) );
keyText.setSize( new java.awt.Dimension( 130, 20 ) );
jLabel2.setText( "Cursor Type:" );
代码示例来源:origin: stackoverflow.com
usernameLogin = new JTextField("Username...",20);
usernameLogin.setLocation(650,200);
usernameLogin.setSize(500, 30);
usernameLogin.setVisible(true);
pane.add(usernameLogin, 1, 0);
passwordLogin.setSize(500, 30);
passwordLogin.setVisible(true);
pane.add(passwordLogin, 1, 0);
代码示例来源:origin: Var3D/var3dframe
public void setSize(int w,int h){
super.setSize(w,h);
panel.setSize(w,h);
if(nativeTextField==null||nativeTextField.getBorderStyle()!= NativeTextField.BorderStyle.RoundedRect){
textField.setSize(getWidth(),getHeight());
textField.setLocation(0,0);
textMessage.setSize(getWidth(),getHeight());
textMessage.setLocation(0,0);
}else {
textField.setSize(getWidth(),getHeight()-18);
textField.setLocation(0,9);
textMessage.setSize(getWidth(),getHeight()-18);
textMessage.setLocation(0,9);
}
}
内容来源于网络,如有侵权,请联系作者删除!