Questions tagged [awt]

The Abstract Window Toolkit (AWT) is Java's original platform-independent windowing, graphics, and user-interface widget toolkit.

-2
votes
0answers
17 views

How to write java events

Well I'm beginner in java, and I was asked to use events in my program, not asking for code but for the message that appears whenever I try using the event classes. When I add ( @Override ), it ...
0
votes
0answers
18 views

How to calculate the width of a string in justified JRTemplatePrintText?

Is it possible to calculate the width of a string in a JRTemplatePrintText with the alignment "justified"? I already tried to use FontRenderContext of AWT but this only worked with left aligned ...
2
votes
1answer
43 views

Float font size is not working in OpenJDK

Float font size is not working in OpenJDK.Seems that the font size is rounded off while calculating string bounds e.g. 11.4 -> 11 & 11.5 -> 12However in oracle jdk its working perfectly.Any ...
-1
votes
1answer
27 views

Paint two overlaid JLabels

I want to paint a JLabel over another.I override paint() so that a second JLabel is painted after calling super.paint().However this second JLabel is not painted at all (because it is not showing, I ...
0
votes
1answer
30 views

Create light in JAVA using RadialGradientPaint

Im working on a simple game engine using java.Im want to make some light in the game and I want to use RadialGradientPaint.Here is my light class package engine.graphics;import java.awt....
-2
votes
0answers
51 views

Cannot render a BufferedImage passed through a super() method to an abstract class (likely a constructor issue)

I have an abstract Tile class and a Dirt class that extends Tile and calls the super() method of the Tile class. It passes in the x/y of the tile, whether or not it's solid, and a BufferedImage (in ...
0
votes
1answer
19 views

Java Applet - Stop other threads from changing Graphics color

as part of a school project we have to create a little game using Applets. I'm working on some tests right now but there's one thing I can't quite figure out:I want to have multiple objects flying on ...
1
vote
1answer
21 views

Java MVC: How to set changed the main model class properly when another class changed

I am writing a program where some elements need to be selected by clicking on them. I am doing this using the MVC principle. I have the following Model classpublic class Model extends Observable {...
-2
votes
0answers
27 views

Null pointer exception in Thread-3 [duplicate]

I am currently working through some tutorials from marcusman.comHere is the code. The null pointer exception is coming from the RenderHandler class, renderImage method, the first line in that method....
0
votes
1answer
31 views

How to draw curved lines on the screen with LinkedList and MouseListeners?

I am new to Java, as for my class's final project, I am developing a paint application that enables users to draw rich curved lines and common geometric shapes like rectangle and oval, also users can ...
1
vote
1answer
31 views

Java: Are abstract methods in awt listeners called callback methods?

The question is as the title goes. I'm slightly confused with the concept. For example, are methods like void actionPerformed(ActionEvent e) also called callback functions in Java?
0
votes
0answers
14 views

Animation doesn't work, component just moves along the x axis

I'm trying to make an Agar.io simulation, so I'm using MouseMotionListener's mouseMoved method to find the cursor's location, and calculating the difference between the cursor's coordinates and agar's ...
0
votes
0answers
19 views

Why is it moving the same circle every time I click, regardless of distance?

I am making a sports-play design simulator in which a "coach" adds a list of players, and you are able to move them around on screen using mouseClicked, mouseDragged, mouseReleased. It calculates the ...
0
votes
1answer
16 views

How can we use the abstract getScreenSize() method in Toolkit class?

Searching on java api document, i found that the getScreenSize() method is an abstract method in the Toolkit class. Now i'm wondering why the code below works.Dimension d=Toolkit.getDefaultToolkit(...
0
votes
3answers
22 views

I want to refresh my Java Frame! (Making Clock Program)

I want to refresh my Frame Program using java language.Look at this image:I want to update hours and minute value like this:but I don't know how to use update() function and repaint() function....

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,