but if my miscounted wount it be outofbounds?
Type: Posts; User: Daigan
but if my miscounted wount it be outofbounds?
63, I changed the for loop from 7 to 63.
Here's the whole code:
// The "TicTacToe3d" class.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import hsa.*;
public class TicTacToe3D extends JFrame...
// The "TicTacToe3d" class.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import hsa.*;
public class TicTacToe3D implements ActionListener
{
So I think what's supposed to happen is that I make three panels say like this
[] - First panel
[] - Second panel
[] - Third panel
Then inside those panel there should be 9 buttons arrange in...
They pretty much just went in the center..
So I tried the FlowLayout Manager, but the buttons didn't go inside the panels
panelB1.setLayout (new FlowLayout ());
panelB1.setBorder (BorderFactory.createLineBorder (Color.BLACK,...
Alright, thanks I was able to add it. Is there a layout manager for the Panels?
So here's the whole code:
// The "TicTacToe3d" class.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import hsa.*;
So I should just make 3 panels like snowguy13 said, right? So that the references to the first two objects won't be lost after the loop.
Oh I just changed SingleBoard to GameBoard. My problem right now is I'm not sure how to add the JButtons to the panels because of the error, which I'm not sure how to fix..
private JButton buttons[] = new JButton [9];
JPanel panel[] = new JPanel [3];
private boolean checkWin = false;
//Count turns starts at 0
int count = 0;
//X or O variable...
Not exactly the values, lets say I want to access two arrays of JButton which are
buttons[0] and buttons[1]
I can access them fine on the last panel but, I don't know how to access them on the...
class SingleBoard extends JPanel
{
public SingleBoard (ActionListener e)
{
setLayout (new GridLayout (3, 3));
for (int i = 0 ; i <= 8 ; i++)
...
Alright, thanks for your advice.
I'm expecting the loop in the intro method to keep looping if the user inputs a number other than 0. Same goes for the mainmenu method, I expect it to keep asking an input until it gets either a 5,3,...
// The "LiquidConversion" class.
import java.awt.*;
import hsa.Console;
public class LiquidConversion
{
static Console c; // The output console
static String procstr;
...
I removed the true in the while statement. And changed that from true to false and it still doesn't loop. Doesn't it mean that while runLoop is true don't stop looping?
// The "LiquidConversion" class.
import java.awt.*;
import hsa.Console;
public class LiquidConversion
{
static Console c; // The output console
static String procstr;
...
Yeah it still doesn't work though I changed it to this.
if (proc == 5 || proc ==3 || proc == 2)
runLoop = false;
runLoop is declared as a Boolean and true.
cause it keeps on going if I don't.
public void mainmenu ()
{
title ();
System.out.print("If you wish to exit press 5, if you want to go the intro press 2, and if you want to continue 3:");
do
...