java

Java GUI repaint() problem? [solved]

Hi, I have a JFrame. This JFrame contains a JButton. I click the JButton and 10 JTextFields are created. the problem: I cannot see them until "I force a repaint()" by resizing the window. Only then do I see the JTextFields created. CODE: JPanel points = new JPanel(); //Creating the JTextFields: for (int i=0; i<10; i++) { JTextFie...

uninstall plugins in Eclipse 3.4.X

Hi, The GUI for managing plugins in Eclipse got a bit of an overhaul in version 3.4.0. This GUI is accessed via the "Software Updates..." option in the Help menu. This displays the following dialog: Notice that the option to remove the selected plugin (Mylyn) is greyed out. In fact, this is true of virtually every installed plugin. ...

Unused code plugin in Eclipse 3.4.1

Hi, I recently upgraded to the latest version of Eclipse (3.4.1). It appears that the unused code detector plugin doesn't work with this version. When I try running it, I get the error message: Problems running UCDetector. Check error log No enum const class org.ucdetector.preferences.WarnLevel.Ignore Has anyone else had this ...

Simple properties to string conversion in Java

Using Java, I need to encode a Map<String, String> of name value pairs to store into a String, and be able to decode it again. These will be stored in a database column, and will probably usually be short and simple, so the common case should produce a simple nice looking line, but shouldn't corrupt the data, even if it contains unexpe...

Recomend a (standalone) java debugger

As the title suggests what is a good debugger for Java? I've come from a C/C++/Ada background so I've become very accustomed to gdb :). On the java side I've only used jdb and jswat but I would like to ask what java debugger do you recomend and why. Some background: I'll be using the debugger to debug a Swing Applications running on ( a...

How can I add a context menu to the Windows Explorer for a Java application?

How would one go about adding a submenu item to the windows explorer context menu (like for example 7-Zip does) for a Java application? ...

Java GUI Swing Model Explanation

I've been working with Java GUI for a while now but the whole model/structure of JFrames, paint(), super, etc is all murky in my mind. I need a clear explanation or link that will explain how the whole GUI system is organized. stackoverflow-ers: can you help me? Thanks everyone, some more answers would be better but this is great! ...

Java get JPanel Components

I have a JPanel full of JTextFields... for (int i=0; i<maxPoints; i++) { JTextField textField = new JTextField(); points.add(textField); } How do I later get the JTextFields in that JPanel? Like if I want their values with TextField.getText(); Thanks ...

JTable updates not appearing

I have a JTable with a custom TableModel called DataTableModel. I initialized the table with a set of column names and no data as follows: books = new JTable(new DataTableModel(new Vector<Vector<String>>(), title2)); JScrollPane scroll1 = new JScrollPane(books); scroll1.setEnabled(true); scroll1.setVisible(true); JSplitPane jsp1 = new J...

Is it good practice to replace Class with Class<? extends Object> to avoid warnings?

In a bunch o' places in my code, I have something like this: public Class mySpecialMethod() { return MySpecialClass.class; } which causes the warning Class is a raw type. References to generic type Class should be parameterized. But, if I replace Class with Class<? extends Object> the warning goes away. Is this ...

Java Listener inheritance

I have a java class which fires custom java events. The structure of the code is the following: public class AEvent extends EventObject { ... } public interface AListener extends EventListener { public void event1(AEvent event); } public class A { public synchronized void addAListener(AListener l) { .. } public synchroni...

invokeAll() is not willing to acept a Collection<Callable<T>>

Hey I fail to understand why this code won't compile ExecutorService executor = new ScheduledThreadPoolExecutor(threads); class DocFeeder implements Callable<Boolean> {....} ... List<DocFeeder> list = new LinkedList<DocFeeder>(); list.add(new DocFeeder(1)); ... executor.invokeAll(list); The error msg is: The method invokeAll(Col...

Java 6 JVM Hang

Apologies for the long post, but I wonder if I could get some more eyeballs on this before I submit a bug report to Sun. JVM: 6u11 O/S: Windows XP SP3 Hardware: AMD Athlon 64 X2 4600+ @ 2.41GHz, with 3.25 GB RAM. I believe I have encountered a fault in the JVM where no thread is given a monitor. In the following thread traces, the mon...

scrollbar action in java

Hi, i'm begginner in java, i have textarea and i have set only verticle scrollbar to that textarea.i'm appending data for every 1 minute to textarea,problem is when new data appends to the textarea scrollbar will move up.To see the new data,every time i have to drag the scroll bar, that is not the requirment.i want scrollbar should not m...

Work around Java's static method dispatching without Double Dispatch/Visitor patterns

I am using a class Foo that provides these methods: String overloadedMethod(Object) String overloadedMethod(Goo) Since Java statically dispatches on the non-receiver argument, I cannot just pass my value (which is an Object, but might have dynamic type Goo) and rely on the JVM to dynamically choose the "correct" method. This is my cu...

How to set a breakpoint in Eclipse in a third party library?

I'm getting a NullPointerException in a Class from a 3rd party library. Now I'd like to debug the whole thing and I would need to know from which object the class is held. But it seems to me that I cannot set a breakpoint in a Class from a 3rd party. Does anyone know a way out of my trouble? Of course I'm using Eclipse as my IDE. Upda...

Cleanest way to build an SQL string in Java

I want to build an SQL string to do database manipulation (updates, deletes, inserts, selects, that sort of thing) - instead of the awful string concat method using millions of "+"'s and quotes which is unreadable at best - there must be a better way. I did think of using MessageFormat - but its supposed to be used for user messages, ...

Java: creating a date object from a string and inserting into MySQL

Anytime I have to handle dates/times in java it makes me sad I'm trying to parse a string and turn it into a date object to insert in a preparepared statement. I've been trying to get this working but am having no luck. I also get the helpful error message when I go to compile the class. "Exception in thread "main" java.lang.Error: Un...

How to obtain a kerberos service ticket via GSS-API?

Does anyone know how to get a service ticket from the Key Distribution Center (KDC) using the Java GSS-API? I have a thick-client-application that first authenticates via JAAS using the Krb5LoginModule to fetch the TGT from the ticket cache (background: Windows e.g. uses a kerberos implementation and stores the ticket granting ticket in...

Why can't static methods be abstract in Java

The question is in Java why can't I define an abstract static method? for example abstract class foo { abstract void bar( ); // <-- this is ok abstract static void bar2(); //<-- this isn't why? } ...