Are GUIComponents X and Y ignored by Render()? #695
Replies: 8 comments
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022).
Posted: 2019-12-06 11:22:06
User: KvaGram [] (age: 1068 days 🔥; posts: 52)
So, I'm building a grapical element here.
For now I use RoundRect (planning on adding images later).
@Override public void render(Graphics2D g) { super.render(g); if (!loc.isValidSection()) return; g.setStroke(new BasicStroke(1)); g.setColor(new Color(186, 190, 180)); g.fillRoundRect((int)getX() + 5, (int)getY() + 5, (int)getWidth()-5, (int)getHeight()-5, 10, 10); g.setColor(new Color(61, 58, 50)); g.setStroke(new BasicStroke(4)); g.drawRoundRect((int)getX() + 5, (int)getY() + 5, (int)getWidth()-4, (int)getHeight()-4, 10, 10); }
Am I doing it wrong? It seems a bit cumbersome to have to cast the X and Y to int and then add them to the draw and fill commands.
Beta Was this translation helpful? Give feedback.
All reactions