Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38840 > unrolled thread
| Started by | Knute Johnson <groups@585ranch.com> |
|---|---|
| First post | 2019-03-31 16:11 -0500 |
| Last post | 2019-03-31 18:06 -0500 |
| Articles | 2 — 1 participant |
Back to article view | Back to comp.lang.java.programmer
Graphics2D#fill3DRect? Knute Johnson <groups@585ranch.com> - 2019-03-31 16:11 -0500
Re: Graphics2D#fill3DRect? Knute Johnson <groups@585ranch.com> - 2019-03-31 18:06 -0500
| From | Knute Johnson <groups@585ranch.com> |
|---|---|
| Date | 2019-03-31 16:11 -0500 |
| Subject | Graphics2D#fill3DRect? |
| Message-ID | <q7rad8$77s$1@dont-email.me> |
I don't see any 3D effect. Running on Windows 8 with OpenJDK 11.0.2.
Screen capture of window at http://knutejohnson.com/test.png. I tried
it with the Graphics#fill3DRect too and got the same results. Anybody
see anything different?
Thanks!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class test extends JPanel {
public test() {
setPreferredSize(new Dimension(640,480));
}
public void paintComponent(Graphics g2D) {
Graphics2D g = (Graphics2D)g2D;
Rectangle b = getBounds(null);
g.setColor(Color.WHITE);
g.fill(b);
g.setColor(Color.BLUE);
g.fill3DRect(b.x+40,b.y+40,b.width-80,b.height-80,true);
}
public static void main(String... args) {
EventQueue.invokeLater(() -> {
JFrame f = new JFrame("test");
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
f.add(new test(),BorderLayout.CENTER);
f.pack();
f.setVisible(true);
});
}
}
[toc] | [next] | [standalone]
| From | Knute Johnson <groups@585ranch.com> |
|---|---|
| Date | 2019-03-31 18:06 -0500 |
| Message-ID | <q7rh4q$unj$1@dont-email.me> |
| In reply to | #38840 |
On 3/31/2019 5:04 PM, Stefan Ram wrote: > ram@zedat.fu-berlin.de (Stefan Ram) writes: >> Today, with "retina" displays, a pixel is nothing. > > There once was the recommendation to set the rectangle color > equal to the background color for this method. If you do > this, in fact, you can see some kind of 3D rectangle without > magnification, so, > > g.setColor( java.awt.Color.GRAY ); > g.fill( b ); > g.fill3DRect( b.x+40, b.y+40, b.width-80, b.height-80, true ); > > . > > If I switch to gray for the background and white for the rectangle I now see 1 pixel of edge on the right and bottom sides (I think). Thanks! k
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web