« first day (5 days earlier)      last day (21 days later) » 

4:49 AM
@MadProgrammer I am here
 
Still lurking
 
haha
how are you?
 
It's Monday, I have a list of meetings which should keep me in a comma for the rest of the week...
 
oh sounds cool but for your info , i am looking for a wealthy wife so you can send your bill to her :D
 
Did not know SO had a chat...
 
4:52 AM
ya man it is coolest website ever
 
eh
Some people are pretty mean
 
@MadProgrammer can I ask my question?
trust me you will learn a lot
 
Hes busy helping me
 
haha k I can wait
 
Just send her ;)
 
4:54 AM
k send my regards as well
nogg is very hasty to get help so I am here
 
Well I'm still posting to Nogg's question so knock yourself out
 
means to ask my answer away?
 
public class OnePlayer {

public static void main(String[] args) {
JFrame jf = new JFrame("One Player");
jf.setSize(300, 125);
jf.setLocationRelativeTo(null);

jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPanel topPanel = new JPanel();
JPanel bottomPanel = new JPanel();

topPanel.setLayout(new GridLayout(2, 4, 5, 5));

JLabel total = new JLabel("Total:");
JTextField totalInput = new JTextField(5);
JLabel bet = new JLabel("Bet:");
JTextField betInput = new JTextField(5);
JLabel dice1 = new JLabel("Dice 1:");
when I put these lines
int totalAmount = Integer.parseInt(totalInput.getText());
int totalBet = Integer.parseInt(betInput.getText());
out of the play.addactionlistener
inpttextboxes do not update the values why?
 
It's possible the fields don't contain valid text that can be converted to an int
You should be trapping the NumberFormatException that is thrown by these methods...
 
5:01 AM
no when I put inside the play.add... they reads perfectly
 
I have so many questions :(
public void update(Graphics g) {
if (image == null) {
image = createImage(this.getWidth(), this.getHeight());
second = image.getGraphics();
}

second.setColor(getBackground());
second.fillRect(0, 0, getWidth(), getHeight());
second.setColor(getForeground());
paint(second);

g.drawImage(image, 0, 0, this);

}
Can you explain this?
 
It's an attempt to perform double buffering, this kind of code appears in old (of date) Applets, as Swing is now double buffered by default. Good reason not to use Applet (or Frame) or override paint of top level containers (like JApplet or JFrame)
 
talking to me?
 
He's talking to me
So let me ask you this real quick MadProgrammer
Im in CS we just do C++/C# stuff
 
Okay, I'm getting two conversations :P
Yep
 
5:05 AM
Im trying to do java on the side and saw I could develop games in java and port them to android
 
he is gone
 
Is it easier for me to just do it in android and learn it there
oh
waht
No, he's still here.
 
would you plz tell me why the scopping is gonna be matter here?
 
Yes, learn the Android API! There is a world of difference between Swing and Android, and not just the UX
(@nogg)
 
I figure if I can get a few games out in the store it would show for experience
but who knows
 
5:07 AM
@KickButtowski Okay, I've run through the code a few times and it seems to work okay for me, the Total and Bet fields update and the Dice fields update
 
Any good and recent android sources you know of for quick starting?
 
@Nogg Yes, if you can demonstrate a releasable app, it will look good for you.
 
@MadProgrammer what do u mean? did you try to have that out of the play.add...?
 
@Nogg Since I've not really done Android myself, not really. Start with the Google offical site and see where it takes you...
 
Thank you man
 
5:09 AM
@Nogg r u done/?
:/
 
Yeah, I think so
I think im going to forgo working with a mouse listener
and just rebuild my app based more for android
which should handle taps better
(I assume)
It's just hard to mathmatically map a 12 sided figure
 
@KickButtowski No, the ActionListener handles it just fine. Are you trying to write a separate method to handle this functionality? If so, you will have a scope issue, as the fields you are relying on are local to the main method
@Nogg Yes, it'll be all "touch" based, but the basic idea of using a list and looping through would be the same...
 
@MadProgrammer my question is why when I put them out of the play.add... they cannot be seen?
 
I would loop the piece.getSelected() and if it returned true then I know which one is selecte3d
Thats Howd Id do it I think
Trying to rely on classes more
I dont know
Im a scrub
 
@KickButtowski Cause the method you are calling has no context to the location where the fields are declared. They are declared locally within the main method. The ActionListener is a special case, as it can "see" the local method context (more or less), where as your new method can not
 
5:14 AM
k so if I gonna declare them as filed variables it is better?
 
Yeah, but main is also static, so, you will want to create a OnePlayer constructor or non-static method which you can call from main, otherwise you will run into more trouble
 
k thank you for your answr the last question
 
(Sorry for having two conversations going on at once) but how do most people normally handle mouse listeners? Is the image loaded into a 2d array of every pixel or something? If you have 30 objects your painting can you even do that?
 
when you run the code, you see that two textfiled is closed to top
how can i maked them go down a little bit
i did 5 5 for spanning but it seems it does not work
 
@KickButtowski You could use an EmptyBorder on topPanel
 
5:20 AM
what do you mnean?
 
@Nogg Normally, the API's provide some kind of "image" object/class (java.awt.Image, java.awt.BufferedImage` for Swing for example), which is a abstract or virtual representation of the image which, typically, the API knows how to paint
@KickButtowski topPanel.setBorder(new EmptyBorder(20, 0, 0, 0); or some such...
 
I used borderlayout what is gonna happene to that?
 
@KickButtowski Nothing, a LayoutManager and a Border are two different things, but the Border can affect the preferred size of the container it's applied to, which is what you want...
 
thank you sir for your help. I will u posted about my wife add soon ;D
@MadProgrammer have great day over there sir :)
 
Keep coding ;)
 

« first day (5 days earlier)      last day (21 days later) »