Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Gravity Pike
Feb 8, 2009

I find this discussion incredibly bland and disinteresting.

rhag posted:

So in order to achieve your goal you should have your own object, with a setNeckbeards() method. Create one instance of that object, add it to the vector, set the neckbeards value to something else, and see it change everywhere that object is referenced.

So, basically I need to...

code:
public class Goon {
   public Thing<Integer> neckbeards;
   public Thing<String> name;
   public Thing<Boolean> hasAClue;
   public Vector<Thing> thingsICareAbout = new Vector<Thing>(); 
   
   class Thing<U extends Object> {
      U contents;
      public void set(U newval) {contents = newval;}
      public U get() {return contents; }
      public String toString() {return contents.toString();}
   }
   
   public static void main() {
   neckbeards.set(1);
   name.set("Gravity Pike");
   thingsICareAbout.add(neckbeards);
   neckbeards.set(0);
   
   System.out.println(neckbeards.toString()+" vs "+thingsICareAbout.elementAt(0).toString());
   }
}
And making sure that every variable I might care about is of type Thing. The get/set syntax is inconvenient, and I figured there might be an easier way built into the language. (Like in C, I could pass &argument, and get it's value with *argument.)

Am I going to run into problems with failing to initialize "contents" if it's not a blocked primative?

Adbot
ADBOT LOVES YOU

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

rhag posted:

What? What does the scope of a variable has to do with references ? What are you talking about?

If you had paid attention to what Gravity Pike actually wrote, as opposed to jumping at straws to pen your magnum opus, my post would seem perfectly clear. No-one else was having problems with the idea that variables of Object type (of whatever storage class) are actually references to objects. I'm sure your parents are very proud that you've mastered the idea well enough to babble incomprehensibly about it.

GP wanted to know if you could create a reference to a variable, and the answer is no, you can't.

rhag posted:

I have no words for this...

That's a relief.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Gravity Pike posted:

And making sure that every variable I might care about is of type Thing.

Yeah, that's a valid way of doing it.

Gravity Pike posted:

The get/set syntax is inconvenient, and I figured there might be an easier way built into the language.

The closest you'll get is the closure stuff I mentioned, if you make the variables instance fields somewhere instead of locals. But I wouldn't say it's easier than what you're doing.

It'd be less syntactically heavyweight if you just make it a public field; that's fairly reasonable for something like this.

code:
class Ref<T> {
  Ref(T value) { this.value = value; }
  public T value;
}
...
Ref<Integer> neckbeards = new Ref<Integer>(0);
...
neckbeards.value = 1;
...
if (neckbeards.value != 0) ...

Gravity Pike posted:

Am I going to run into problems with failing to initialize "contents" if it's not a blocked primative?

Instance variables are always implicitly initialized. Variables of object type get initialized to null.

Volguus
Mar 3, 2009

rjmccall posted:


GP wanted to know if you could create a reference to a variable, and the answer is no, you can't.


So, would you then please tell me what the following code does? What is "ref"?
code:
MyNewRef ref=new MyNewRef();
Here's a hint:

"ref" is a variable.
"ref" holds the reference to the MyNewRef object instance.
whether ref is local, private, public or whatever it doesn't change its status as a variable (you can change its value by saying: ref=new MyNewRef() this getting a new instances), and it will never change the fact that "ref" is just a reference.

If you can't see the absurdity of your statement...

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

rhag posted:

So, would you then please tell me what the following code does? What is "ref"?
code:
MyNewRef ref=new MyNewRef();

It's exactly what you said: a variable that holds a reference to an object. What is wrong with you that you can't comprehend the difference between that and a variable that holds a reference to another variable? References are always references to something; Java allows you to create references to objects (indeed, it's the only way you can interact with objects), but not references to variables.

Here, look, this is a variable that holds a reference to another variable:

code:
int a;
int& b = a;
Note that this is C++ because you cannot express this in Java.

deedee megadoodoo
Sep 28, 2000
Two roads diverged in a wood, and I, I took the one to Flavortown, and that has made all the difference.


I loving love this argument. What round is this?

Volguus
Mar 3, 2009

rjmccall posted:

It's exactly what you said: a variable that holds a reference to an object. What is wrong with you that you can't comprehend the difference between that and a variable that holds a reference to another variable? References are always references to something; Java allows you to create references to objects (indeed, it's the only way you can interact with objects), but not references to variables.

Here, look, this is a variable that holds a reference to another variable:

code:
int a;
int& b = a;
Note that this is C++ because you cannot express this in Java.
:doh: now I get it. You sir are confusing the "variable" concept with the "primitive" concept.

"ref" in my code is a variable
"a" in your code is a variable

ref is a reference to an object, a is a primitive.

Now i get your confusion. Please please, go back to CS101 and brush up on these very simple concepts. Come back after that and we'll talk.

In response to another question in this thread asked earlier:

In Java objects are passed by reference, primitives are passed by value. All the time and you cannot change this. This is something set in stone.
However, there is a set of objects that you cannot change their contents: String,Integer, Double,etc.
As such, even if you are passing a string object as a reference to a method, you cannot change its contents in that method and expect to see the new char array i the caller.
Thus:
code:
String a="a";
myMethod(a);
System.out.println(a);
...
public void myMethod(String a){
a="b";
} 
This code will print "a" to the console. In the myMethod method the string has been initialized with a new object (it became a reference to a different object).
The caller will never know that, it still has a reference to the old object.
The same is true for Integer. Doing this:
code:
Integer i;
i=1;
...
i=2;
is equivalent to doing this:
code:
Integer i;
i=new Integer(1);
...
i= new Integer(2);
So after the second initialization the reference to the first object (new Integer(1)) has been lost (unless kept in some other location, such as a list).

But...all of this babble is really just basic Java. Any book about the language (somewhat decent, not written by a VB programmer ) will tell you this and more.

csammis
Aug 26, 2003

Mental Institution
I think rjmccall and HatfulOfHollow might know all that, and I think it might have been covered repeatedly in this thread :ssh:

rhag posted:

Please please, go back to CS101 and brush up on these very simple concepts. Come back after that and we'll talk.

Didn't call him a gay babby, still not up to AD's standards

HatfulOfHollow posted:

I loving love this argument. What round is this?

43 pages mod 5ish, probably round 8.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

rhag posted:

:words:
The most accurate way to think about this is as follows:

Java passes everything by value, and an object reference is a primitive type.

Inside a method call, when you receive a primitive value on the stack, you can reassign the value and it won't affect the caller. If the primitive type you receive is an object reference and you don't reassign it, you can poke at the object to your heart's content and your actions will have consequences outside the current method.

crazyfish
Sep 19, 2002

Lysidas posted:

The most accurate way to think about this is as follows:

Java passes everything by value, and an object reference is a primitive type.

Inside a method call, when you receive a primitive value on the stack, you can reassign the value and it won't affect the caller. If the primitive type you receive is an object reference and you don't reassign it, you can poke at the object to your heart's content and your actions will have consequences outside the current method.

That's probably the most concise way to put it. My favorite way to demonstrate it is with two code snippets (obvously you'll need an enclosing class):

code:

public static void main (String[] args)
{
   Integer k = new Integer(1);
   doSomething(k);
   System.out.println(k.toString());
}

public static void doSomething(Integer i)
{
   i = new Integer(2);
}

The output here will be 1.

code:
public class SettableThing
{
   private int thing = 0;
   public SettableThing() {}

   public int getThing() { return thing; }
   public void setThing(final int thing) { this.thing = thing; }
}

public static void main (String[] args)
{
   SettableThing k = new SettableThing();
   doSomething(k);
   System.out.println(k.getThing());
}

public static void doSomething(SettableThing i)
{
   i.setThing(5);
}
The output here would be 5.

crazyfish fucked around with this message at 00:11 on Jul 16, 2009

Brain Candy
May 18, 2006

rhag posted:

(concatenate strings with +, while == performs an .equals() ).

BZZZT. == foo is NOT .equals(foo) for Strings

You'd have to use .intern() or something similar for == to consistently work.

irishcoffee
Sep 16, 2008

Brain Candy posted:

BZZZT. == foo is NOT .equals(foo) for Strings

You'd have to use .intern() or something similar for == to consistently work.

so.. == just points to memory. Iirc, it literally compares memory addresses (yes, even in java) and a .equals() method has 2-4 different checks for equality, one of which (*should) includes == (to see if the memory reference is the same).

Volguus
Mar 3, 2009

Brain Candy posted:

BZZZT. == foo is NOT .equals(foo) for Strings

You'd have to use .intern() or something similar for == to consistently work.

That is correct. However, "interning" is done automatically most of the time due to the following specifications:

# Literal strings within the same class (§8) in the same package (§7) represent references to the same String object (§4.3.1).
# Literal strings within different classes in the same package represent references to the same String object.
# Literal strings within different classes in different packages likewise represent references to the same String object.
# Strings computed by constant expressions (§15.28) are computed at compile time and then treated as if they were literals.
# Strings computed by concatenation at run time are newly created and therefore distinct.

For those who are wondering wtf this all means, run the following code:
code:
		String a="Hel"+"lo";
		String b="Hello";
		System.out.println(a==b);
		char[] c={'H','e','l','l','o'};
		String d="";
		for(int i=0;i<c.length;i++){
			d+=c[i];
		}
		System.out.println(d);
		System.out.println(d==b);
		System.out.println(d.intern()==b);
It will print:
true
Hello
false
true

dealmaster
Dec 24, 2005

Somebody call for an exterminator?
I'm using Netbeans to build a sample GUI and all the code autogeneration is going fine but I've run into a problem. I put so much stuff in the GUI that it goes past 1200 pixels in the vertical direction, so I can't see some of the buttons and text fields I've added to the bottom of the GUI. The GUI doesn't have a scrollbar so I added one from the Swing Controls menu, but I guess it isn't linked to the main JFrame because sliding the scrollbar up and down doesn't actually do anything.

Basically, does anyone know what I'd need to do to add scrollbar functionality to my GUI via Netbeans? I'm not very familiar with Swing, so writing it myself rather than autogenerated would not be preferred, but if I have to I can.

Shavnir
Apr 5, 2005

A MAN'S DREAM CAN NEVER DIE
I think what you want is a ScrollPane and then you will need to insert your GUI elements into the ScrollPane. You can do this with the editor in netbeans, it'll just take you a while to put everything back where it was :\

dealmaster
Dec 24, 2005

Somebody call for an exterminator?

Shavnir posted:

I think what you want is a ScrollPane and then you will need to insert your GUI elements into the ScrollPane. You can do this with the editor in netbeans, it'll just take you a while to put everything back where it was :\

Yeah I figured this was the route to go, but I'm having some weird behavior with the ScrollPane. When I put any text field, label, or anything else into the ScrollPane that I create, it immediately fills the whole thing up and won't let me resize it. Have you run into this before?

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
Just wanna throw out that a CS101 class that uses both the terms 'objects' and 'primitive types' is probably worthless

csammis
Aug 26, 2003

Mental Institution
Gonna throw out that a CS101 class that uses Java is absolutely worthless

baquerd
Jul 2, 2007

by FactsAreUseless

csammis posted:

Gonna throw out that a CS101 class that uses Java is absolutely worthless

When I teach a 101 equivalent, I make sure to use a combination of LISP and 68000 assembly to give them the best start in life.

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog

rhag posted:

:doh: now I get it. You sir are confusing the "variable" concept with the "primitive" concept.

"ref" in my code is a variable
"a" in your code is a variable

ref is a reference to an object, a is a primitive.

Now i get your confusion. Please please, go back to CS101 and brush up on these very simple concepts. Come back after that and we'll talk.

In response to another question in this thread asked earlier:

In Java objects are passed by reference, primitives are passed by value. All the time and you cannot change this. This is something set in stone.
However, there is a set of objects that you cannot change their contents: String,Integer, Double,etc.
As such, even if you are passing a string object as a reference to a method, you cannot change its contents in that method and expect to see the new char array i the caller.
Thus:
code:
String a="a";
myMethod(a);
System.out.println(a);
...
public void myMethod(String a){
a="b";
} 
This code will print "a" to the console. In the myMethod method the string has been initialized with a new object (it became a reference to a different object).
The caller will never know that, it still has a reference to the old object.
The same is true for Integer. Doing this:
code:
Integer i;
i=1;
...
i=2;
is equivalent to doing this:
code:
Integer i;
i=new Integer(1);
...
i= new Integer(2);
So after the second initialization the reference to the first object (new Integer(1)) has been lost (unless kept in some other location, such as a list).

But...all of this babble is really just basic Java. Any book about the language (somewhat decent, not written by a VB programmer ) will tell you this and more.

lollin @ dis

pseudopresence
Mar 3, 2005

I want to get online...
I need a computer!

quadreb posted:

When I teach a 101 equivalent, I make sure to use a combination of LISP and 68000 assembly to give them the best start in life.

So GOAL then? http://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp

useless player
Mar 16, 2009
I am trying to make a few modifications to a java program that was written by someone else. The previous programmer left her source code as well as the .class files. I can run the main .class file and the program starts, however when I recompile the main .java file without making any changes to it and try to run the program again, I encounter a NullPointerException for one of the lines in the main file. Replacing the .class file that I compiled with the original one makes the program run again. The only explanation I can come up with is that the .class was compiled from a different source file than the one I was left with. Am I correct, or is there another explanation?

useless player fucked around with this message at 19:32 on Jul 16, 2009

Volguus
Mar 3, 2009

useless player posted:

I am trying to make a few modifications to a java program that was written by someone else. The previous programmer left her source code as well as the .class files. I can run the main .class file and the program starts, however when I recompile the main .java file without making any changes to it and try to run the program again, I encounter a NullPointerException for one of the lines in the main file. Replacing the main .class file that I compiled with the original one makes the program run again. The only explanation I can come up with is that the .class was compiled from a different source file than the one I was left with. Am I correct, or is there another explanation?

That is the most logical explanation. The original .class was compiled from a different source file than what you have.

Volguus
Mar 3, 2009

dealmaster posted:

Yeah I figured this was the route to go, but I'm having some weird behavior with the ScrollPane. When I put any text field, label, or anything else into the ScrollPane that I create, it immediately fills the whole thing up and won't let me resize it. Have you run into this before?

To get what you want, you'll need to create a custom scrollable component (extents JPanel probably).
You have a nice tutorial here: http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html#scrollable

useless player
Mar 16, 2009

rhag posted:

That is the most logical explanation. The original .class was compiled from a different source file than what you have.

So I've tried decompiling the main .class file and examining the source. The class constructor calls a method with a really weird name, $$$setupUI$$$(), which does not appear in the source file I was given. Searching through every source file for the string 'setupUI' turns up nothing. This really sucks, but I guess the class file is from another source.

Edit: Actually it turns out that the previous programmer worked on the project in an IDE and her computer crashed. I'm just working with the raw source files and that would explain the weirdness about compiling. Does anybody have any experience in a situation like this?

useless player fucked around with this message at 02:49 on Jul 17, 2009

1337JiveTurkey
Feb 17, 2005

rhag posted:

To get what you want, you'll need to create a custom scrollable component (extents JPanel probably).
You have a nice tutorial here: http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html#scrollable

That's one option. The other is to just drop a JPanel in there and put all of the components inside of that.

baquerd
Jul 2, 2007

by FactsAreUseless

useless player posted:

Edit: Actually it turns out that the previous programmer worked on the project in an IDE and her computer crashed. I'm just working with the raw source files and that would explain the weirdness about compiling. Does anybody have any experience in a situation like this?

IDE's shouldn't generally produce code that is IDE dependent (that's not to say it hasn't happened). Why don't you debug why you're getting the exception and work from there?

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

useless player posted:

So I've tried decompiling the main .class file and examining the source. The class constructor calls a method with a really weird name, $$$setupUI$$$(), which does not appear in the source file I was given. Searching through every source file for the string 'setupUI' turns up nothing. This really sucks, but I guess the class file is from another source.

Edit: Actually it turns out that the previous programmer worked on the project in an IDE and her computer crashed. I'm just working with the raw source files and that would explain the weirdness about compiling. Does anybody have any experience in a situation like this?

What's the fully qualified package for that class? I googled $$$setupUI$$$ and found a groovy project for the intellij ide here: http://www.jetbrains.net/jira/browse/GRVY-2045

Anything look familiar?

Mill Town
Apr 17, 2006

quadreb posted:

IDE's shouldn't generally produce code that is IDE dependent (that's not to say it hasn't happened). Why don't you debug why you're getting the exception and work from there?

They would if she used the IDE's GUI layout tool.

baquerd
Jul 2, 2007

by FactsAreUseless

Mill Town posted:

They would if she used the IDE's GUI layout tool.

Not if the tool was any good - a good GUI layout tool is merely a frontend, not something that makes your software required to be bundled with extra layout classes and crap. Licensing, portability, etc - it's a mess.

zootm
Aug 8, 2006

We used to be better friends.

rhag posted:

That is correct. However, "interning" is done automatically most of the time due to the following specifications:

# Literal strings within the same class (§8) in the same package (§7) represent references to the same String object (§4.3.1).
# Literal strings within different classes in the same package represent references to the same String object.
# Literal strings within different classes in different packages likewise represent references to the same String object.
# Strings computed by constant expressions (§15.28) are computed at compile time and then treated as if they were literals.
# Strings computed by concatenation at run time are newly created and therefore distinct.
Not to drag up this conversation any more, but in practice this tends to mean that interning is not done most of the time automatically because most of the time you're not comparing strings known at compile-time (in most cases you'd want to do that an enum or similar would be a more concise way of expressing the concept).

dealmaster
Dec 24, 2005

Somebody call for an exterminator?

1337JiveTurkey posted:

That's one option. The other is to just drop a JPanel in there and put all of the components inside of that.

For right now I've switched to a tabbed layout and it actually works a little better as far as organization is concerned, and it's alleviated the need for scrollbars, but I would still like them to be an option since I don't know what resolutions people will be using this application on.

As of right now an abstraction of the basic layout is this:

code:
           ----JPanel1----Tab 1 GUI stuff
           |
JTabbedPane----JPanel2----Tab 2 GUI stuff
           |
           ----JPanel3----Tab 3 GUI stuff
So ideally I'd like scrollbars to be optional on each of those JPanels, just in case someone using this application is running some stupidly small resolution. Do you know how to get JPanels to scroll vertically and horizontally?

geeves
Sep 16, 2004

This is more an Eclipse setup question (and I come from an IntelliJ setup so Eclipse is very new to me)

Project tree is /svn/project/trunk/core/src/main/java/com/company/package/class

Project builds fine with Maven, and works properly when deployed; however Eclipse keeps throwing errors that: com.company.package is not valid and needs to be main.java.com.package.

It also does not recognize / reference other classes within the same package. Eclipse can see my Maven repo, but not this. :wtc:

I have the same project setup with IntelliJ and it's working fine.

Using Dynamic Web Project at the moment, but the others had similar results. Is this a setting or in the type of project it should be?

zootm
Aug 8, 2006

We used to be better friends.

geeves posted:

Project tree is /svn/project/trunk/core/src/main/java/com/company/package/class

Project builds fine with Maven, and works properly when deployed; however Eclipse keeps throwing errors that: com.company.package is not valid and needs to be main.java.com.package.
Are you using the Maven plugin for Eclipse? I imagine some horrors occur trying to make Maven's ultra-consistent weirdness work within an ad-hoc project context.

Volguus
Mar 3, 2009

dealmaster posted:

For right now I've switched to a tabbed layout and it actually works a little better as far as organization is concerned, and it's alleviated the need for scrollbars, but I would still like them to be an option since I don't know what resolutions people will be using this application on.

As of right now an abstraction of the basic layout is this:

code:
           ----JPanel1----Tab 1 GUI stuff
           |
JTabbedPane----JPanel2----Tab 2 GUI stuff
           |
           ----JPanel3----Tab 3 GUI stuff
So ideally I'd like scrollbars to be optional on each of those JPanels, just in case someone using this application is running some stupidly small resolution. Do you know how to get JPanels to scroll vertically and horizontally?

Yes.
By creating a new class, that extends JPanel and implements Scrollable.
The tutorial that I've posted the link to provides the solution nicely.
And scrollbars will only appear when needed.

However...I'm not really sure why do you need scrollbars at all. I mean..the components should resize themselves when the application resizes. A very good layout to use is GridBagLayout. Complex but very powerful. If the users have a small resolution (you have to set a minimum supported, lets say 800x600), the components will just be smaller, but they should be proportional to a 1600x1200 resolution.

Volguus
Mar 3, 2009

geeves posted:

This is more an Eclipse setup question (and I come from an IntelliJ setup so Eclipse is very new to me)

Project tree is /svn/project/trunk/core/src/main/java/com/company/package/class

Project builds fine with Maven, and works properly when deployed; however Eclipse keeps throwing errors that: com.company.package is not valid and needs to be main.java.com.package.

It also does not recognize / reference other classes within the same package. Eclipse can see my Maven repo, but not this. :wtc:

I have the same project setup with IntelliJ and it's working fine.

Using Dynamic Web Project at the moment, but the others had similar results. Is this a setting or in the type of project it should be?
This sounds like Eclipse doesn't know what your root source directory is . In the project properties, set the source directory to that "main/java". Then the packages will follow from there( eclipse will properly see com.company.package as the package).

geeves
Sep 16, 2004

zootm posted:

Are you using the Maven plugin for Eclipse? I imagine some horrors occur trying to make Maven's ultra-consistent weirdness work within an ad-hoc project context.

I have m2eclipse installed, but I don't think I'll use, I usually just build from the command line. I had the MVN plugin for IntelliJ installed and maybe used it once total over 3 years.

quote:

This sounds like Eclipse doesn't know what your root source directory is . In the project properties, set the source directory to that "main/java". Then the packages will follow from there( eclipse will properly see com.company.package as the package).

Yep, this was it - thanks!

dealmaster
Dec 24, 2005

Somebody call for an exterminator?

rhag posted:

Yes.
By creating a new class, that extends JPanel and implements Scrollable.
The tutorial that I've posted the link to provides the solution nicely.
And scrollbars will only appear when needed.

However...I'm not really sure why do you need scrollbars at all. I mean..the components should resize themselves when the application resizes. A very good layout to use is GridBagLayout. Complex but very powerful. If the users have a small resolution (you have to set a minimum supported, lets say 800x600), the components will just be smaller, but they should be proportional to a 1600x1200 resolution.

Yeah I tried using this layout, but I can't seem to figure out how to spread the combo boxes and text fields out how I'd like to. I tried using different anchor values and messing with the insets, but all the buttons, labels, etc. all end up clumping together. Even if I try to leave a bunch of blank space between two of them using the customize layout option in Netbeans, they don't actually move far away from each other, they're still stuck together.

Volguus
Mar 3, 2009

dealmaster posted:

Yeah I tried using this layout, but I can't seem to figure out how to spread the combo boxes and text fields out how I'd like to. I tried using different anchor values and messing with the insets, but all the buttons, labels, etc. all end up clumping together. Even if I try to leave a bunch of blank space between two of them using the customize layout option in Netbeans, they don't actually move far away from each other, they're still stuck together.

you need to get away from that GUI editor. It's so easy to write a nice UI in java, that using a GUI editor will only slow you down.
Read this: http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html

It tells you how to use it, what all the arguments mean, etc.

Adbot
ADBOT LOVES YOU

dealmaster
Dec 24, 2005

Somebody call for an exterminator?

rhag posted:

you need to get away from that GUI editor. It's so easy to write a nice UI in java, that using a GUI editor will only slow you down.
Read this: http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html

It tells you how to use it, what all the arguments mean, etc.

Yeah it would probably be better, but I've never done GUI programming by hand, so trying to do what I've already done with the editor by hand is really daunting. At the moment, the GUI editor is allowing me to do things that I have no idea how to do by hand, which is why I chose to use it.

Edit: I'm taking your advice though, I'm not too far along and programming it by hand is actually already giving me functionality that the autogenerated code didn't produce.

Edit2: I'm glad I took your advice, I've found that you're right, copy and pasting code and doing it by hand is a lot faster and effective than drawing boxes on the screen, plus I'm getting familiar with all these classes, which is a good thing.

dealmaster fucked around with this message at 18:57 on Jul 17, 2009

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply