Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
18 May, 2013, 23:38:19 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: java giant button glitch -  (Read 334 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Snake X
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: Today at 14:23:50
Date Registered: 18 March, 2010, 02:48:47
Posts: 806


Topic starter
Total Post Ratings: +25

View Profile
« on: 26 May, 2011, 02:34:53 »
0

My friend saved his project to my computer so that I could try to get help for him. He is working on a slot machine and however.. The only button added fills the whole entire screen Crazy


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Random;
import java.util.*;

public class cactus extends JApplet implements ActionListener {

Image s = getImage(getCodeBase(), "spin.jpg");
ImageIcon spin = new ImageIcon(s);

Random r = new Random();

Container contentArea;

String x = ("spin");

JButton FIRE = new JButton("spin");

JLabel slot11,slot12,slot13,slot21,slot22,slot23,slot31,slot32,slot33;

JLabel win = new JLabel("you have won congratz");

JLabel lose = new JLabel("hahahahahahahahahahaha you lose. GLaDos won. have a nice day =3");

Graphics g;

public void init() {
contentArea = getContentPane();
contentArea.setBackground(Color.PINK);
FlowLayout manager = new FlowLayout();
contentArea.setLayout(manager);
FIRE.addActionListener(this);
FIRE.setEnabled(true);
contentArea.add(FIRE);
setContentPane(contentArea);
}
public void actionPerformed(ActionEvent event) {
Image Lemon = getImage(getCodeBase(), "a.jpg");
ImageIcon pica = new ImageIcon(Lemon);
Image Cherry = getImage(getCodeBase(), "b.jpg");
ImageIcon picb = new ImageIcon(Lemon);
Image randomCelebrity = getImage(getCodeBase(), "c.jpg");
ImageIcon picc = new ImageIcon(randomCelebrity);

if(event.getSource()==FIRE) {
int random1 = r.nextInt(3)+1;
int random2 = r.nextInt(3)+1;
int random3 = r.nextInt(3)+1;

slot11 = new JLabel(pica);
slot12 = new JLabel(picb);
slot13 = new JLabel(picc);

slot21 = new JLabel(pica);
slot22 = new JLabel(picb);
slot23 = new JLabel(picc);

slot31 = new JLabel(pica);
slot32 = new JLabel(picb);
slot33 = new JLabel(picc);

contentArea.removeAll();
setContentPane(contentArea);

//random1
if(random1==1){
contentArea.add(slot11);
contentArea.add(FIRE);

setContentPane(contentArea);
}
if(random1==2){
contentArea.add(slot12);
contentArea.add(FIRE);
}
if(random1==3){
contentArea.add(slot13);
contentArea.add(FIRE);
}
//random2
if(random2==1){
contentArea.add(slot21);
contentArea.add(FIRE);

setContentPane(contentArea);
}
if(random2==2){
contentArea.add(slot22);
contentArea.add(FIRE);

setContentPane(contentArea);
}
if(random2==3){
contentArea.add(slot23);
contentArea.add(FIRE);

setContentPane(contentArea);
}
//random3
if(random3==1){
contentArea.add(slot31);
contentArea.add(FIRE);

setContentPane(contentArea);
}
if(random3==2){
contentArea.add(slot32);
contentArea.add(FIRE);

setContentPane(contentArea);
}
if(random3==3){
contentArea.add(slot33);
contentArea.add(FIRE);

setContentPane(contentArea);
}


if ((random1 == 1 && random2 == 1 && random3 == 1) ||
(random1 == 2 && random2 == 2 && random3 == 2) /*||
(random1 == 3 && random2 == 3 && random3 == 3))*/) {
win.setFont(new Font("wingdings2", Font.BOLD, 42));
win.setForeground(Color.red);
contentArea.remove(win);
contentArea.add(win);
setContentPane(contentArea);
}
else {
contentArea.add(lose);
setContentPane(contentArea);
}
}
}
}
Logged

There's a Zombie for that™
nemo
LV9 Veteran (Next: 1337)
*********
Offline Offline

Last Login: 04 April, 2013, 01:12:57
Date Registered: 16 May, 2010, 03:55:30
Posts: 1198

Total Post Ratings: +83

View Profile
« Reply #1 on: 27 May, 2011, 05:49:50 »
0

look into using layouts.
Logged


Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.159 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.