本文整理了Java中javax.swing.JTextField.getWidth()
方法的一些代码示例,展示了JTextField.getWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.getWidth()
方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:getWidth
暂无
代码示例来源: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: igniterealtime/Spark
popup.pack();
if(validItems.size()*16<=SparkManager.getContactList().getHeight()-SparkManager.getSearchManager().getSearchServiceUI().getHeight()-14){
popup.setSize(textField.getWidth(), validItems.size()*16+5);
}else{
popup.setSize(textField.getWidth(), SparkManager.getContactList().getHeight()-SparkManager.getSearchManager().getSearchServiceUI().getHeight()-14);
代码示例来源:origin: robward-scisys/sldeditor
textField.getX() + textField.getWidth() + 5,
y,
BasePanel.WIDGET_BUTTON_WIDTH,
代码示例来源:origin: atarw/material-ui-swing
@Override
/**
*This metod drive a line button on JTextField
* @fixed by https://github.com/vincenzopalazzo
*/
public void paintSafely(Graphics g) {
JTextField c = (JTextField) getComponent();
super.paintSafely(g);
if (drawLine) {
int x = c.getInsets().left;
int y = c.getInsets().top;
int w = c.getWidth() - c.getInsets().left - c.getInsets().right;
g.setColor(c.getSelectionColor());
g.fillRect(x, c.getHeight() - y - 1, w, 2);
}
}
代码示例来源:origin: stackoverflow.com
lblTest2.setBounds(txtTest1.getX() + txtTest1.getWidth() + 8, insets.top + 5, lblTest2.getPreferredSize().width, lblTest2.getPreferredSize().height);
txtTest2.setBounds(lblTest2.getX() + lblTest2.getWidth() + 8, insets.top + 5, txtTest2.getPreferredSize().width, txtTest2.getPreferredSize().height);
lblTest3.setBounds(txtTest2.getX() + txtTest2.getWidth() + 5, insets.top + 5, lblTest3.getPreferredSize().width, lblTest3.getPreferredSize().height);
txtTest3.setBounds(lblTest3.getX() + lblTest3.getWidth() + 5, insets.top + 5, txtTest3.getPreferredSize().width, txtTest3.getPreferredSize().height);
lblTest4.setBounds(txtTest3.getX() + txtTest3.getWidth() + 5, insets.top + 5, lblTest4.getPreferredSize().width, lblTest4.getPreferredSize().height);
txtTest4.setBounds(lblTest4.getX() + lblTest4.getWidth() + 5, insets.top + 5, txtTest4.getPreferredSize().width, txtTest4.getPreferredSize().height);
btnCalculate.setBounds(txtTest4.getX() + txtTest4.getWidth() + 5, insets.top + 5, btnCalculate.getPreferredSize().width, btnCalculate.getPreferredSize().height);
lblWeight1.setBounds(insets.left + 5, insets.top + 30, lblWeight1.getPreferredSize().width, lblWeight1.getPreferredSize().height);
txtWeight1.setBounds(lblWeight1.getX() + lblWeight1.getWidth() + 5, insets.top + 30, txtWeight1.getPreferredSize().width, txtWeight1.getPreferredSize().height);
lblWeight2.setBounds(txtWeight1.getX() + txtWeight1.getWidth() + 5, insets.top + 30, txtWeight1.getPreferredSize().width, txtWeight1.getPreferredSize().height);
txtWeight2.setBounds(lblWeight2.getX() + lblWeight2.getWidth() + 10, insets.top + 30, txtWeight2.getPreferredSize().width, txtWeight2.getPreferredSize().height);
lblWeight3.setBounds(txtWeight2.getX() + txtWeight2.getWidth() + 10, insets.top + 30, txtWeight2.getPreferredSize().width, txtWeight2.getPreferredSize().height);
txtWeight3.setBounds(lblWeight3.getX() + lblWeight3.getWidth() + 10, insets.top + 30, txtWeight3.getPreferredSize().width, txtWeight3.getPreferredSize().height);
lblWeight4.setBounds(txtWeight3.getX() + txtWeight3.getWidth() + 15, insets.top + 30, txtWeight4.getPreferredSize().width, txtWeight3.getPreferredSize().height);
txtWeight4.setBounds(lblWeight4.getX() + lblWeight4.getWidth() + 15, insets.top + 30, txtWeight4.getPreferredSize().width, txtWeight4.getPreferredSize().height);
代码示例来源:origin: stackoverflow.com
Rectangle viewRect = viewport.getViewRect();
searchField.setSize(searchField.getPreferredSize());
int x = (viewRect.x + viewRect.width) - searchField.getWidth();
int y = viewRect.y;
searchField.setLocation(x, y);
内容来源于网络,如有侵权,请联系作者删除!