本文整理了Java中javax.swing.JTextField.getInsets()
方法的一些代码示例,展示了JTextField.getInsets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.getInsets()
方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:getInsets
暂无
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
public Insets getInsets() {
return textField.getInsets();
}
代码示例来源:origin: org.orbisgis/orbisgis-view
@Override
public Insets getInsets() {
Insets i = super.getInsets();
i.left += icon.getIconWidth() + 10;
return i;
}
代码示例来源:origin: orbisgis/orbisgis
@Override
public Insets getInsets() {
Insets i = super.getInsets();
i.left += icon.getIconWidth() + 10;
return i;
}
代码示例来源: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: org.scijava/scijava-ui-swing
private void initPrompt(String text) {
prompt.setText(text);
prompt.setFont(textField.getFont().deriveFont(Font.ITALIC));
prompt.setForeground(changeAlpha(textField.getForeground(), 128));
prompt.setBorder(new EmptyBorder(textField.getInsets()));
prompt.setHorizontalAlignment(SwingConstants.LEADING);
textField.setLayout(new BorderLayout());
textField.add(prompt);
updatePromptVisibility();
}
代码示例来源:origin: org.japura/japura-gui
Insets fieldInsets = field.getInsets();
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
protected void updateWidget() {
Font font = editedFigure.getFont();
font = font.deriveFont(font.getStyle(), (float) (editedFigure.getFontSize() * view.getScaleFactor()));
textField.setFont(font);
textField.setForeground(editedFigure.getTextColor());
textField.setBackground(editedFigure.getFillColor());
Rectangle2D.Double fDrawBounds = editedFigure.getBounds();
Point2D.Double fDrawLoc = new Point2D.Double(fDrawBounds.getX(), fDrawBounds.getY());
if (editedFigure.get(TRANSFORM) != null) {
editedFigure.get(TRANSFORM).transform(fDrawLoc, fDrawLoc);
}
Point fViewLoc = view.drawingToView(fDrawLoc);
Rectangle fViewBounds = view.drawingToView(fDrawBounds);
fViewBounds.x = fViewLoc.x;
fViewBounds.y = fViewLoc.y;
Dimension tfDim = textField.getPreferredSize();
Insets tfInsets = textField.getInsets();
float fontBaseline = textField.getGraphics().getFontMetrics(font).getMaxAscent();
double fBaseline = editedFigure.getBaseline() * view.getScaleFactor();
textField.setBounds(
fViewBounds.x - tfInsets.left,
fViewBounds.y - tfInsets.top - (int) (fontBaseline - fBaseline),
Math.max(fViewBounds.width + tfInsets.left + tfInsets.right, tfDim.width),
Math.max(fViewBounds.height + tfInsets.top + tfInsets.bottom, tfDim.height)
);
}
内容来源于网络,如有侵权,请联系作者删除!