java如何在panel中加边框
以下是我的五子棋代码部分。。谁能帮我给棋盘加个边框或者弄个背景呢。。publicChessClient1(Stringhost){ticTacToeHost=host;d...
以下是我的五子棋代码部分。。谁能帮我给棋盘加个边框或者弄个背景呢。。 public ChessClient1(String host){
ticTacToeHost=host;
displayArea=new JTextArea(4,30);
displayArea.setEditable(false);
add(new JScrollPane(displayArea),BorderLayout.SOUTH);
boardPanel=new JPanel();
boardPanel.setLayout(new GridLayout(ROWCOLUMN,ROWCOLUMN,0,0));
board=new Square[ROWCOLUMN][ROWCOLUMN];
for(int row=0;row<board.length;row++)
{
for(int column=0;column<board[row].length;column++)
{
board[row][column]=new Square("",row*ROWCOLUMN+column);
boardPanel.add(board[row][column]);
}
}
}
}
idField=new JTextField();
idField.setEditable(false);
add(idField,BorderLayout.NORTH);
panel2=new JPanel();
panel2.add(boardPanel,BorderLayout.CENTER);
add(panel2,BorderLayout.CENTER);
setSize(300,325);
setVisible(true);
startClient();
} 展开
ticTacToeHost=host;
displayArea=new JTextArea(4,30);
displayArea.setEditable(false);
add(new JScrollPane(displayArea),BorderLayout.SOUTH);
boardPanel=new JPanel();
boardPanel.setLayout(new GridLayout(ROWCOLUMN,ROWCOLUMN,0,0));
board=new Square[ROWCOLUMN][ROWCOLUMN];
for(int row=0;row<board.length;row++)
{
for(int column=0;column<board[row].length;column++)
{
board[row][column]=new Square("",row*ROWCOLUMN+column);
boardPanel.add(board[row][column]);
}
}
}
}
idField=new JTextField();
idField.setEditable(false);
add(idField,BorderLayout.NORTH);
panel2=new JPanel();
panel2.add(boardPanel,BorderLayout.CENTER);
add(panel2,BorderLayout.CENTER);
setSize(300,325);
setVisible(true);
startClient();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询