I have a JDialog with a button/textfield for the user to select a file. Here's the code:
FileDialog chooser = new FileDialog(this, "Save As", FileDialog.SAVE );
String startDir = saveAsField.getText().substring( 0, saveAsField.getText().lastIndexOf('\\') );
chooser.setDirectory(startDir);
chooser.setVisible(true);
String fileName = cho...
I'm an Eclipse newbie and I'm trying to build a mixed AWT/SWT application. Here's my code:
public class HelloWorldSWT {
public static void main(String[] args) {
Frame frame = new Frame("My AWT Frame"); // java.awt.Frame
frame.setLayout( new BorderLayout() );
Canvas canvas = new Canvas(); // java.awt.Canvas
...
I want to display a Java FileDialog and sets its initial size to something reasonable (it doesn't show the maximize button, and a lot of users might not know you can use alt-space X instead). I tried setBounds but it didn't do anything, and I don't see a method for maximizing it; what am I missing?
Update: on Windows at least, the syste...
Hi everyone,
I'm working on a project that requires me to do simple geometrical transformations (translation, reflection over x and y axis) on some figures drawn on a Java applet. The previous guy working on the applet was drawing the figures from arrays representing the caretesian points for the vertices of each figure. I decided to...
Hi,
I am trying to override default java Button behavior and trying to add additional label to a button. I am new to java GUI and thought that overriding paint method will solve my problem, but when I do that and draw additional label in Button paint method it looks fine, but my label disappears if I click on that button in my applicati...
I have a set of points that i want to turn into a closed polygon in Java. I'm currently trying to use java.awt.geom.Point2D and java.awt.geom.Area but can't figure out how to turn a group of the points into an Area.
I think I can define a set of Line2Ds based on the points and then add those to the Areas, but that's a lot of work and I...
I have a JTable with JLabel[][] as data. Now I want to detect a double click on either the JLabel or a table cell (but only in one of the columns). How can I add an Action/MouseListener on JLabel respectively table cell?
...
I recently read the blog posts on Pushing Pixels that describe how to achieve native transparency and translucency with pure Java. The needed classes reside on com.sun.awt namely com.sun.awt.AWTUtilities.
I was wondering how i could include the needed classes (not just this one) into my distro since the classes are available only when y...
hi
i have to writing an applet, in left side i must use an panel to contain a list of vehicles that can be a list of buttons,what is the problem, number of the vehicles are not given !!!
so, i need to scrolling panel when number of vehicles is too much,
i do this for jframe, but it didn't work correct with panel, please help me with ...
Why does the setColor of a Graphics object reset when I use the repaint method?
...
How can I get JTextFields to allow Ctrl-Delete and Ctrl-Backspace when editing text?
In various other programs, these key combinations can delete an entire word in one go.
From what I can tell, the default behaviour of a JTextField allows the user to use CTRL to jump over an entire word when using left and right keys, and to select an ...
Hello,
I'm searching for he source of a graphical bean editor... a (very basic) beanbox if you prefer...
Here is what I would like to achieve :
I have an application which uses some customizable objects that more or less honor the java bean spec...
What I mean by that is that they have getters and setters for most properties...
The sw...
Given an Applet object, is it possible to programatically obtain a "screen shot" of the applet window (represented as say a BufferedImage)?
JApplet applet = this;
// ... code here ...
BufferedImage screenshotOfApplet = ...;
...
I'm changing a program from AWT to Swing, as proposed on the second chapter of Java Swing's book, and the panel just disappears when I do the change from Panel to JPanel. The same doesn't happen when I change from Button to JButton.
It seems to be a bug, since it appears to be trivially simple to do so - just adding an extra J to the na...
I need to create and store thumbnails (of images from the web) and store them on the server. Can I use the awt libraries (as listed below) on a linux server running in a datacenter (without a monitor)? I do not know if the server has a graphics card or needs one for these libraries to work...
import java.awt.GraphicsConfiguration;
impo...
How would I force a Frame to repaint() immediately after it is maximized, or resized?
I can't find what method is called when that specific operation takes place. I have a bunch of graphics that are written with Graphic objects in paint and their orientation depends on the real time feedback from getWidth() and getHeight() but paint isn...
I am using EmbeddedSwingComposite (built on SWT_AWT bridge) which is mentioned in the following article :
http://www.eclipse.org/articles/article.php?file=Article-Swing-SWT-Integration/index.html
Though it says that using the above technique modality issues are resolved. But in my case there are still some modality issues left. I guess ...
I have a java applet built using awt.
I draw some text on a panel object and everything goes fine.
but when resizing the windows all the text disappears.
this behaviour is different among different jvms and platforms.
moving to swing isn't a possible option, because we have to maintain compatiblty with Microsoft JVM.
...
I have a java chat applet that's compatible with JDK1.1 so it works well even with Microsoft JVM.
the thing is, sometimes the chat area within the applet becomes white and messed up.
It can only be fixed back by closing the whole Internet Explorer (all windows and tabs) and restarting it.
this doesn't exist when running the applet on ...
I'm trying to write a silly little app using Java and AWT.
It simply runs and animates some shapes, so as a first step, I created a simple app that clears a canvas with fillRect every 50ms.
The problem is, my app flickers every now and then with the underlying window colour. Google is failing me when it comes to finding simple hello-wo...