Good afternoon! It is necessary to make a list (vertical) from lists of events (horizontal). There are at least 2 problems: the area of the list of events (horizontal scrolling) expands beyond the borders of the panel. Apparently, the problem is with Layout, but I can not find the right combination; horizontal scrolling does not work (probably due to the
Tag: awt
Center shape defined in Cartesian coordinates in JPanel
I have a shape (triangle for example) defined in Cartesian coordinates and I’d like to translate the shape to the center of a JPanel. I’ve been able to translate about the JPanel’s 0,0 orientation, but I can’t figure out how to center based on the JPanel’s width and height. I’d like to be able to center any shape defined by
Is it possible to add the same ActionListener for 100 buttons?
I have created an array of buttons (JButton[] jb = new JButton[100]) and I want to add the same action listener for all the buttons in the jb array instead of adding them one by one. Just imagine every time I click one of the buttons displayed on the screen and it will print out the index of that button
Java awt draw elements around a circle
I’m currently writing a little game and I came over a problem. I need to draw 64 small circles at the border of a big circle. So I want something like this: I’ve already tried many things, but they didn’t worked. How can this be done in java, using the java.awt.Component#paint() method and the java.awt.Graphics class? Thanks. Answer So, your
change color of already drawn Graphics object in java AWT not working
Am trying to change color after drawing the object in window, this is what i came up with, am a beginner so this is messy. } The class Figure is an abstract class that is inheriting from java.awt.Frame Any remarks about how to make this code cleaner will be appreciated, thanks. Answer Before you begin on something as complex as
My problem is when I press the clear button, it just clears the textfield and not data of the previous numbers pressed
The task here is to make a Java program that is like a pincode process. I just have a problem with the process of clearing since when I press the clear button, it actually clears the textfield but when I press new numbers, the numbers I typed before even after pressing clear still shows up Please help me with my
Why is JScrollpane not added to JTextArea in my TextEditor?
I can’t understand why the JScrollpane won’t be added to JTextArea, is this because of some sort of layout problem? This is a text editor made by my friend, he initially made it with only AWT but I then replaced AWT TextArea with swing’s JTextArea to wrap text. Output: Edit: Thanks everyone who invested their time for me. I figured
Rendering 3D objects on 2D Canvas using Java AWT
I’m trying to port this JS code on Java because I got bored with programming a prototype of my 2D Java Game and I wanted to make my game into 3D, then I got this weird rendering bug, I think my math or logic was off… Sample data: Legend: Cube: the actual cube, has a transform of x, y, z
2d double array to image
I’m currently working on a simulation with continuous agents, which leave a pheromone trail on a 2d double array. The pheromone trails need to be on a 2d array because of a diffusion with a mean filter that needs to be performed. Ultimately, I need to visualise the agents and the pheromone trails, by transforming the double array directly into
Exception in thread “AWT-EventQueue-0” java.lang.RuntimeException: Uncompilable code – package org.netbeans.lib.awtextra does not exist [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 1 year ago. Improve this question