chop ficaro

Ranch Hand
+ Follow
since May 02, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by chop ficaro

right, method equals, lol thanks for reminding me
13 years ago
o ya there was a method compare or something, let me look that up
13 years ago
trying to see if the user has entered text in a text field but
ConductorDiameterIn.getText()==""
always evaluates to false
13 years ago
ive got a java.math.bigInteger in the DENOMINATOR of a function, and i need it to return a float. how do i do this while keeping as much accuracy as possible (the denominator could be as large as 10^80)
13 years ago
solution found, thank you all very much for helping me debug my program
13 years ago

Rob Prime wrote:Also, the resistance you're printing is the local variable, not the instance variable of your DCR instance.


ok well why is setting the variable in main a static context?
btw main is just to test this function. this is a small part of a larger project, and i need to set the variables in another file
i want to do this the orthodox way so my code is readable, and though putt's code works, it doesnt seem orthodox. my code with the static context problem seems to make more sense to me but of coarse it doesnt work
13 years ago

Santhosh Puttu wrote:oh yes. Without creating object we cannot call non static method......
I think this should work..


thank you puttu, you code worked, but i dont undertand why. my constructor still returns a type, which i now remember is illegal thanks to the other comments. heres what i tried before your code, it didnt work, something about non static variables in a static context, but i thought it would work:
13 years ago
main cant find the constructor of the class on compile time. what on earth could be wrong?

DCR.java

error readout
13 years ago
tyvm! your suggestion fixed my problem!
13 years ago

Rob Prime wrote:

chop ficaro wrote:


I really suggest you name your variables differently. Never use a class name as variable name. It makes your code confusing to read; when I first glanced over your code I thought I saw a few static calls:

Anyway, I see one problem with your BackgroundPanel. It has no children, so its size will be 0x0. Try giving it a preferred size.




thats what this is
//panel.setMinimumSize( new Dimension( 224, 224 ) );
it doesnt work remove the comment mark and see
13 years ago
i am trying to put a picture on the top of my swing GUI that stretches horizontally to fit the width of the window as it resizes

http://www.camick.com/java/source/BackgroundPanel.java
this is the code for a commonly used function that scales images to their components size. it works by overloading the paintcontainer class, which is called every time the window resizes, which then calls the paint class. they simply grab the size of the container and draw the image to those dimensions

the image that needs to be resized must be placed in BorderLayout.NORTH, because the rest of my GUI is in BorderLayout.CENTER, but BackgroundPanel cant be placed in NORTH, the image disappears, even with a minimum size set. it cant be placed inside a panel inside a panel inside NORTH either. ive been reading over the code for BackgroundPanel and its driving me crazy i cant figure out why

here is some short example code, not my program but it simplifies the problem:
13 years ago
can i make an image scale to fit the window with BorderLayout.CENTER?
13 years ago
lol, the first google result for "JTextArea scroll" says that
lol those idiots, that's why i come here
i have my scroll pane now and it works great
TYVM
13 years ago
ive read that scroll bars are supposed to appear when the text exceeds the area, but for my program, they are not appearing. heres my program, click the radio buttons to add content to the text area and see that the scroll bar does not appear. i am running windows 7 64
13 years ago
i have a window with one text field in it that accepts an int, and as soon as a user enters that int i want a window to appear with the entered amount of text fields. and as soon as the user enters the data in those text fields, my program needs to store the data in those text fields in an array or vector or something so i can access it later

i know ill have to use a for loop with the entered number and create the textfields and add them to a panel, but how do i refer to them when i dont know how many there will be?
13 years ago