Hello guys. How do you draw a 3d shape in a GUI? Here is my code: -
import javax.swing.SwingUtilities;
-
import javax.swing.JFrame;
-
import javax.swing.JPanel;
-
import javax.swing.BorderFactory;
-
import java.awt.Color;
-
import java.awt.Dimension;
-
import java.awt.Graphics;
-
-
public class SwingPaintDemo2 {
-
-
public static void main(String[] args) {
-
SwingUtilities.invokeLater(new Runnable() {
-
public void run() {
-
createAndShowGUI();
-
}
-
});
-
}
-
-
private static void createAndShowGUI() {
-
System.out.println("Created GUI on EDT? "+
-
SwingUtilities.isEventDispatchThread());
-
JFrame f = new JFrame("Swing Paint Demo");
-
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
f.add(new MyPanel());
-
f.pack();
-
f.setVisible(true);
-
}
-
}
-
-
-
class MyPanel extends JPanel {
-
-
public MyPanel() {
-
setBorder(BorderFactory.createLineBorder(Color.black));
-
}
-
-
public Dimension getPreferredSize() {
-
return new Dimension(250,200);
-
}
-
-
public void paintComponent(Graphics g) {
-
super.paintComponent(g);
-
-
// 3d shape code goes here
-
}
-
}
-
6 1711
Please define "3D shape". I am a poor programmer who can only afford a flat screen.
Please define "3D shape". I am a poor programmer who can only afford a flat screen.
:-) I think the OP is talking about eye points, view cones and projections and such.
kind regards,
Jos (<--- on a paper tape ;-)
:-) I think the OP is talking about eye points, view cones and projections and such.
kind regards,
Jos (<--- on a paper tape ;-)
You are right JosAH. Cones, cube, pyramids etc.
You are right JosAH. Cones, cube, pyramids etc.
I didn't say that, I mentioned the technology participants in 3D projection math.
You can either google for it (it is simple 101 geometry) or use the Java3D package
that does it for you but it also does a whole lot more.
kind regards,
Jos
Is this thread dead now? Did the OP expect boilerplate code? Too bad because
the subject can be an interesting one.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Rose Alit,mon mignon |
last post by:
Hi,
I'm trying the following and doesn't work.
Could someone have any clue?
dim arrMyShapes(1 to MxA,1 to MxB) of New Shape
Thanks
JeanM
|
by: Anchorman |
last post by:
I'm using the following SHAPE command:
SHAPE {SELECT * FROM Chapters WHERE SchoolID=320}
APPEND ({SELECT * FROM ChapterLink}
RELATE ID TO ChapterID) AS Advisors
({SELECT FirstName, LastName...
|
by: minjie |
last post by:
Hello,
I have several reports that were written with ADO shape command (in
C++) to access Microsoft Access database. Now we have migrated all the
data from Access to DB2 UDB (version 8.1), and the...
|
by: PM |
last post by:
Hi,
Im a student currently designing a game for a project.
As part of my game, I want to be able to drag a shape over a series of
panels. The shape needs to be able to be dropped on any of the...
|
by: nets-rac |
last post by:
Hi,
I use c# to automate powerpoint. I created a new shape with
PowerPoint.Shape shape =
slide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal,
left, top, width, height);...
|
by: saravanansvks |
last post by:
Dear Friends,
I have prepared a programme in Visual Basic for SHAPE OPERATOR.But my coding are changing the shape only.It does not changes the fill style of the shape tool .And it is not giving ant...
|
by: JWest46088 |
last post by:
I am a little confused about what I need to do here. I created four separate classes (Circle, Rectangle, Square, and Triangle) that each calculate their own area and perimeter via user input.
Now...
|
by: Peter Webb |
last post by:
I have created two sets of circles using addshape, innercircle(i) and
outercircle(i), and I want to group them in pairs so innercircle(1) and
outercircle(1) are grouped, etc. I am supposed to be...
|
by: Linda Liu[MSFT] |
last post by:
Hi Moondaddy,
I downloaded your sample project and run it and did see the problem on my
side.
There're three problems in the source code of your project.
1. You should move the following...
|
by: ab12 |
last post by:
I'm trying to write a program in C that gets a shape outlined with asterisks from the user, and returns that shape filled with asterisks. It will also get the coordinates of a point inside the shape...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |