本文整理了Java中javax.swing.JTextField.paint()
方法的一些代码示例,展示了JTextField.paint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.paint()
方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:paint
暂无
代码示例来源:origin: ron190/jsql-injection
@Override
public void paint(Graphics g) {
try {
super.paint(g);
} catch (ClassCastException e) {
// Fix #4301, ClassCastException: sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData
LOGGER.error(e.getMessage(), e);
}
if (this.getText().length() == 0) {
int h = this.getHeight();
int w = this.getWidth();
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
Insets ins = this.getInsets();
int c0 = this.getBackground().getRGB();
int c1 = this.getForeground().getRGB();
int m = 0xfefefefe;
int c2 = ((c0 & m) >>> 1) + ((c1 & m) >>> 1);
g.setColor(new Color(c2, true));
g.setFont(this.getFont().deriveFont(Font.ITALIC));
FontMetrics fm = g.getFontMetrics();
g.drawString(
this.placeholderText,
this.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT
? w - (fm.stringWidth(this.placeholderText) + ins.left + 2)
: ins.left + 2,
h / 2 + fm.getAscent() / 2 - 1
);
}
}
代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-misc-swing
@Override
public void paint(Graphics g) {
super.paint(g);
validating.paint(g);
}
代码示例来源:origin: net.imagej/imagej-ui-swing
@Override
public void paint(Graphics g) {
super.paint(g);
if (counter > 0) {
requestFocusInWindow();
counter--;
}
}
};
代码示例来源:origin: mucommander/mucommander
/**
* Override JTextField's paint method to show progress information.
*/
@Override
public void paint(Graphics g) {
super.paint(g);
if(progressValue>0) {
g.setColor(progressColor);
g.fillRect(0, 0, (int)(getWidth()*progressValue/(float)100), getHeight());
}
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public void paint(Graphics _g) {
BuLib.setAntialiasing(this, _g);
super.paint(_g);
if (drop_) {
Rectangle r = getDropRect();
// _g.setColor(new Color(255,128,0,64));
// _g.fillRoundRect(r.x,r.y,r.width,r.height,9,9);
_g.setColor(new Color(255, 128, 0));
_g.drawRoundRect(r.x, r.y, r.width - 1, r.height - 1, 9, 9);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
public void paint(Graphics g) {
super.paint(g);
if (!isFocusOwner() && getText().isEmpty())
hintLabel.paint(g);
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets
@Override
public void paint(Graphics g) {
super.paint(g);
int size = getHeight()-PAD2;
g.drawImage( getScaledImage(size), getWidth()-size-PAD, PAD, null);
}
代码示例来源:origin: eugener/oxbow
@Override
public void paint(Graphics g) {
super.paint(g);
int size = getHeight()-PAD2;
g.drawImage( getScaledImage(size), getWidth()-size-PAD, PAD, null);
}
代码示例来源:origin: org.bidib.org.oxbow/swingbits
@Override
public void paint(Graphics g) {
super.paint(g);
int size = getHeight()-PAD2;
g.drawImage( getScaledImage(size), getWidth()-size-PAD, PAD, null);
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra
@Override
public void paint(Graphics g) {
super.paint(g);
int size = getHeight() - PAD2;
g.drawImage(getScaledImage(size), getWidth() - size - PAD, PAD, null);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
public void paint(Graphics g) {
super.paint(g);
this.setCaretColor(this.getBackground());
this.getCaret().setVisible(false);
this.getCaret().setSelectionVisible(false);
if (error) {
g.setColor(Color.red);
g.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1);
}
switch (isSelect) {
case NONE:
break;
case HOUR:
paintSelectedHour(g);
break;
case MINUTE:
paintSelectedMinute(g);
break;
}
paintHourMinute(g);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
public void paint(Graphics g) {
super.paint(g);
this.setCaretColor(this.getBackground());
this.getCaret().setVisible(false);
this.getCaret().setSelectionVisible(false);
if (error) {
g.setColor(Color.red);
g.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1);
}
switch (isSelect) {
case NONE:
break;
case DAY:
paintSelectedDay(g);
break;
case MONTH:
paintSelectedMonth(g);
break;
case YEAR:
paintSelectedYear(g);
break;
}
paintDayMonthYear(g);
}
代码示例来源:origin: atarw/material-ui-swing
private void changeColorOnFocus(boolean hasFocus) {
JTextField c = (JTextField) getComponent();
/*c.setSelectionColor(hasFocus ? activeBackground : inactiveBackground);
c.setForeground(hasFocus ? activeForeground : inactiveForeground);
c.setSelectedTextColor(hasFocus ? activeForeground : inactiveForeground);*/
if(hasFocus && (activeBackground != null) && (activeForeground != null)){
c.setSelectionColor(activeBackground);
c.setForeground(activeForeground);
c.setSelectedTextColor(activeForeground);
}
if(!hasFocus && (inactiveBackground != null) && (inactiveForeground != null)){
c.setSelectionColor(inactiveBackground);
c.setForeground(inactiveForeground);
c.setSelectedTextColor(inactiveForeground);
}
c.paint(c.getGraphics());
}
内容来源于网络,如有侵权,请联系作者删除!