本文整理汇总了Java中info.clearthought.layout.TableLayout.PREFERRED属性的典型用法代码示例。如果您正苦于以下问题:Java TableLayout.PREFERRED属性的具体用法?Java TableLayout.PREFERRED怎么用?Java TableLayout.PREFERRED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类info.clearthought.layout.TableLayout
的用法示例。
在下文中一共展示了TableLayout.PREFERRED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupLayout
private void setupLayout() {
TableLayout layout = new TableLayout(
new double[] {
TableLayout.MINIMUM, TableLayout.PREFERRED,
TableLayout.MINIMUM, TableLayout.PREFERRED,
TableLayout.MINIMUM, TableLayout.PREFERRED,
TableLayout.PREFERRED
},
new double[] { TableLayout.PREFERRED }
);
layout.setHGap( 8 );
this.setLayout( layout );
this.add( labelAuthor, new TableLayoutConstraints( 0, 0 ) );
this.add( author, new TableLayoutConstraints( 1, 0 ) );
this.add( labelAssignee, new TableLayoutConstraints( 2, 0 ) );
this.add( assignee, new TableLayoutConstraints( 3, 0 ) );
this.add( new JLabel( "Filter" ), new TableLayoutConstraints( 4, 0 ) );
this.add( textFilter, new TableLayoutConstraints( 5, 0 ) );
this.add( checkClosed, new TableLayoutConstraints( 6, 0 ) );
}
示例2: TicTacToeTableFrame
public TicTacToeTableFrame (TableConnectionThread conn) {
super (conn, WIDTH, HEIGHT);
// Create model, view and register view to model
model = new TicTacToeModel (); // create model
boardComponent = new TicTacToeBoardComponent (model); // board
model.addObserver(boardComponent); // board observes model
// Create controller which updates model and controlls the view
controller = new TicTacToeController (model, boardComponent);
controller.setConnection (conn); // connection
boardComponent.setController(controller);
// Add view to a panel and set on table frame
double [][] sizes = {{10, TableLayout.PREFERRED, 10, TableLayout.FILL, 10}, {10, TableLayout.PREFERRED, TableLayout.FILL}};
JogrePanel panel = new JogrePanel (sizes); // create a panel
panel.add (boardComponent, "1,1,l,t"); // add board to panel
panel.add (new PlayerComponent (conn, 0), "3,1,l,t"); // add board to panel
panel.add (new PlayerComponent (conn, 1), "3,1,l,b"); // add board to panel
setGamePanel (panel); // add panel to table frame
// Set up MVC classes in super class
setupMVC (model, boardComponent, controller);
}
示例3: UserLabel
/**
* Create a new user label with a specified label width.
*
* @param user Link to user.
* @param labelWidth Specified label with (using TableLayout).
*/
public UserLabel (User user, double labelWidth) {
super (new double [][] {{16, labelWidth},{TableLayout.PREFERRED}});
ratingSquare = new RatingSquare (user);
userLabel = new JogreLabel (user.getUsername());
setLabelFont (JogreAwt.LIST_FONT);
add (ratingSquare, "0, 0");
add (userLabel, "1, 0");
}
示例4: createSliderAndButtons
private JogrePanel createSliderAndButtons() {
double pref = TableLayout.PREFERRED;
int SPACER_SIZE = 3;
double[][] tableParams = {
{pref, SPACER_SIZE, 100},
{0.33, SPACER_SIZE, 0.34, SPACER_SIZE, 0.33}
};
JogrePanel sliderPanel = new JogrePanel (tableParams);
sliderPanel.add (bidSliderComponent, "0,0,0,4");
sliderPanel.add (foldButton, "2,0");
sliderPanel.add (callButton, "2,2");
sliderPanel.add (bidButton, "2,4");
return sliderPanel;
}
示例5: createWideLabeledComponent
public static JPanel createWideLabeledComponent(JComponent component, String labelText) {
double[][] sizes = {
{TableLayout.PREFERRED, TableLayout.FILL},
{TableLayout.PREFERRED},
};
TableLayout layout = new TableLayout(sizes);
layout.setHGap(SizeHelper.getLayoutHGap());
layout.setVGap(SizeHelper.getLayoutVGap());
JPanel result = new JPanel(layout);
result.add(new JLabel(labelText), "0 0");
result.add(component, "1 0");
return result;
}
示例6: setUpGui
/**
* Set up GUI.
*/
private void setUpGui () {
double pref = TableLayout.PREFERRED;
// Create checkbox panel
double [][] sizes = {{pref, pref, pref, pref, pref, pref, pref, pref,
pref, pref, pref, pref, pref, pref, pref, pref, pref, pref},{pref}};
this.checkBoxPanel = new JPanel (new TableLayout (sizes));
this.checkBoxPanel.setBorder(BorderFactory.createEtchedBorder());
// Create buttons
this.selectAllButton = new JButton ("All");
this.selectNoneButton = new JButton ("None");
this.translateButton = new JButton ("Translate");
this.tableButtonAdd = new JButton ("+");
this.tableButtonDelete = new JButton ("-");
this.tableButtonUp = new JButton ("/\\");
this.tableButtonDown = new JButton ("\\/");
this.formatCB = new JCheckBox ("Show Format");
// Set this layout
sizes = new double [][] {{5, pref, 5, pref, pref, 5, pref, pref, pref, pref, 5, pref, 5, pref, 5}, {5, pref, 5}};
setLayout(new TableLayout (sizes));
add (checkBoxPanel, "1,1");
add (selectAllButton, "3,1");
add (selectNoneButton, "4,1");
add (tableButtonAdd, "6,1");
add (tableButtonDelete, "7,1");
add (tableButtonUp, "8,1");
add (tableButtonDown, "9,1");
add (translateButton, "11,1");
add (formatCB, "13,1");
}
示例7: makeNinetyNinePanel
/**
* Create the panels of the table
*/
private JogrePanel makeNinetyNinePanel() {
double pref = TableLayout.PREFERRED;
double[][] table_params = {
{5, pref, 5, pref, 5, pref, 5, pref, 5},
{5, pref, 5, pref, 5, pref, 5, pref, 5, pref, 5} };
JogrePanel gamePanel = new JogrePanel (table_params);
for (int i=0; i<3; i++) {
int yoff = 3+(i*2);
gamePanel.add(bidComp[i], "1,"+yoff);
gamePanel.add(handComp[i], "3,"+yoff);
if (i != 0) {
gamePanel.add(playedCardComp[i], "5,"+yoff);
}
gamePanel.add(takenTricksComp[i], "7,"+yoff);
}
gamePanel.add(scoreComponent, "3,9,7,9");
gamePanel.add(masterController.makeBidButtonPanel(playedCardComp[0]), "5,3");
// Add the player components
double[][] playerComponentSizes = {{5, pref, 5}, {pref, 5, pref, 5, pref}};
JogrePanel playerComponentPanel = new JogrePanel (playerComponentSizes);
playerComponentPanel.add (new PlayerComponent (conn, 0, true), "1,0,l,c");
playerComponentPanel.add (new PlayerComponent (conn, 1, true), "1,2,l,c");
playerComponentPanel.add (new PlayerComponent (conn, 2, true), "1,4,l,c");
gamePanel.add(playerComponentPanel, "1,9,l,t");
return gamePanel;
}
示例8: setUpGUI
/**
* Set up GUI.
*/
private void setUpGUI () {
// Get labels
labels = JogreLabels.getInstance();
double pref = TableLayout.PREFERRED, fill = TableLayout.FILL;
// Set main layout.
double [][] sizes = {{fill}, {fill}};
setLayout (new TableLayout (sizes));
// Create main panel
sizes = new double [][] {{fill}, {pref, 25, pref, 50, pref}};
JogrePanel mainPanel = new JogrePanel (sizes);
statusLabel = new JLabel (labels.get("fill.in.details"));
if (silentConnect) {
statusLabel = new JLabel (labels.get("logging.in"));
}
statusLabel.setFont (JogreAwt.LIST_FONT);
// If not a silent connect then the user must supply details
if (!silentConnect)
mainPanel.add (getLogonPanel (), "0,0,c,c");
mainPanel.add (getButtonPanel (), "0,2,c,c");
mainPanel.add (statusLabel, "0,4,c,c");
// Add
add (mainPanel, "0,0,c,c");
}
示例9: OctagonsTableFrame
public OctagonsTableFrame (TableConnectionThread conn) {
super (conn);
// Create model, view and register view to model
model = new OctagonsModel ();
boardComponent = new OctagonsBoardComponent (model);
model.addObserver(boardComponent);
// Create controller which updates model and controls the view
controller = new OctagonsController (model, boardComponent);
controller.setConnection (conn);
boardComponent.setController(controller);
// Set up MVC classes in super class
setupMVC (model, boardComponent, controller);
// Create game panel and add main view to it
double pref = TableLayout.PREFERRED;
double [][] sizes = {{pref}, {10, pref, 5, pref, 10}};
JogrePanel panel = new JogrePanel (sizes);
panel.add (new PlayerComponent (conn, 0, true), "0,1,l,c");
panel.add (new PlayerComponent (conn, 1, false), "0,1,r,c");
boardComponent.setBorder (BorderFactory.createLineBorder (Color.black, 3));
panel.add (boardComponent, "0,3,c,c");
// Set game panel on the table frame
setGamePanel (panel);
pack();
}
示例10: TableListRenderer
/**
* Constructor for this renderer.
*/
public TableListRenderer () {
// Create layout
double pref = TableLayout.PREFERRED, fill = TableLayout.FILL;
double [][] sizes = {{16, 16, 60, fill},{pref, pref}};
setLayout (new TableLayout (sizes));
// Create components and add.
visibilitySquare = new VisibilitySquare ();
tableNumLabel = new JogreLabel ();
timeStartedLabel = new JogreLabel ();
extendedInfoLabel = new JogreLabel ();
// Set fonts
tableNumLabel.setFont (JogreAwt.LIST_FONT_BOLD);
timeStartedLabel.setFont (JogreAwt.LIST_FONT);
extendedInfoLabel.setFont (JogreAwt.LIST_FONT);
// Create player panel
// RAW: Hmmm, does this mean that there is a limit of 7 players at a table?
sizes = new double [][]{{pref, pref, pref, pref, pref, pref, pref},{pref}};
playerPanel = new JogrePanel (sizes);
// Add components
add (visibilitySquare, "0,0,c,c");
add (tableNumLabel, "1,0,c,c");
add (timeStartedLabel, "2,0,c,c");
add (playerPanel, "3,0,l,c");
if (jogreClientGui.hasExtendedInfo()) {
add (extendedInfoLabel, "2,1,3,1,l,c");
}
}
示例11: CheckersTableFrame
/**
* @param conn
* @param table
*/
public CheckersTableFrame (TableConnectionThread conn) {
super (conn, WIDTH, HEIGHT);
// Create game data and checkers board and add observers
this.checkersModel = new CheckersModel ();
this.checkersBoard = new CheckersBoardComponent (checkersModel);
// Add component observers to the game data.
checkersModel.addObserver (checkersBoard);
// Set up game controller
this.checkersController = new CheckersController (checkersModel, checkersBoard);
checkersController.setConnection (conn);
checkersBoard.setController (checkersController); // set controller on board
// Set game data and controller (constructor must always call these)
setupMVC (checkersModel, checkersBoard, checkersController);
// Create game panel and add components to it.
double pref = TableLayout.PREFERRED;
double [][] sizes = {{10, pref, 10, pref, 10}, {10, pref, 10}};
JogrePanel panel = new JogrePanel (sizes);
panel.add (checkersBoard, "1,1");
panel.add (new PlayerComponent (conn, 1, true), "3,1,l,t");
panel.add (new PlayerComponent (conn, 0, true), "3,1,l,b");
setGamePanel (panel);
pack();
}
示例12: AdminStatusBar
/**
* Constructor.
*/
public AdminStatusBar () {
// Set layout
double pref = TableLayout.PREFERRED;
double [][] layout = {{pref, 5, pref}, {pref}};
setLayout(new TableLayout (layout));
usersStr = labels.get ("users");
tablesStr = labels.get ("tables");
// Declare labels
userLabel = new JLabel (" ");
tableLabel = new JLabel (" ");
// Update labels
refresh ();
// Set fonts of labels
Font font = userLabel.getFont();
Font plainFont = new Font (userLabel.getFont().getName(), Font.PLAIN, font.getSize());
userLabel.setFont(plainFont);
tableLabel.setFont(plainFont);
// Set borders
userLabel.setBorder(BorderFactory.createLoweredBevelBorder());
tableLabel.setBorder(BorderFactory.createLoweredBevelBorder());
// Add labels to panel
add (userLabel, "0,0");
add (tableLabel, "2,0");
}
示例13: ChineseCheckersTableFrame
public ChineseCheckersTableFrame (TableConnectionThread conn) {
super (conn);
// Get the long jump parameter from the table property
boolean longJumps = "t".equals(table.getProperty("longJumps"));
int numPlayers = table.getNumOfPlayers();
// Create model, view and register view to model
model = new ChineseCheckersModel (numPlayers, longJumps);
boardComponent = new ChineseCheckersBoardComponent (model);
model.addObserver(boardComponent);
// Create controller which updates model and controls the view
controller = new ChineseCheckersController (model, boardComponent);
controller.setConnection (conn);
boardComponent.setController(controller);
// Set up MVC classes in super class
setupMVC (model, boardComponent, controller);
// Add view to a panel and set on table frame
double pref = TableLayout.PREFERRED;
double [][] sizes = {{10, pref, 10}, {10, pref, 10, pref, pref, 5, pref, 5, pref, 5}};
JogrePanel panel = new JogrePanel (sizes, Color.white, new Color (210, 210, 210));
panel.add (boardComponent, "1,1");
panel.add (new JSeparator (), "1,3");
panel.add (new PlayerComponent (conn, 0, true), "1,4,l,c");
panel.add (new PlayerComponent (conn, 1, true), "1,6,l,c");
panel.add (new PlayerComponent (conn, 2, true), "1,8,l,c");
panel.add (new PlayerComponent (conn, 3, false), "1,4,r,c");
panel.add (new PlayerComponent (conn, 4, false), "1,6,r,c");
panel.add (new PlayerComponent (conn, 5, false), "1,8,r,c");
// Set game panel on the table frame
setGamePanel (panel);
pack();
}
示例14: setUpGUI
/**
* Set up the GUI frame.
*/
private void setUpGUI () {
// Set up the layout (TableLayout)
double pref = TableLayout.PREFERRED, fill = TableLayout.FILL;
double [][] sizes = {{10, pref, 10, pref, 10, pref, 10, pref, 10}, {10, pref, 10}};
setLayout(new TableLayout (sizes));
// Declare arrays of object.
TetrisPlayerModel [] playerModels = new TetrisPlayerModel [NUM_OF_PLAYERS];
TetrisGridComponent [] gameGrids = new TetrisGridComponent [NUM_OF_PLAYERS];
TetrisNextShapeComponent [] nextShapes = new TetrisNextShapeComponent [NUM_OF_PLAYERS];
TetrisLabelComponent [] scoreLabels = new TetrisLabelComponent [NUM_OF_PLAYERS];
// Create instances of each object
for (int i = 0; i < NUM_OF_PLAYERS; i++) {
// Create models
playerModels [i] = gameData.getPlayerModel(i);
// Create GUI components
gameGrids [i] = new TetrisGridComponent (
playerModels[i], COLORS[i * 2], COLORS[i * 2 + 1]);
nextShapes [i] = new TetrisNextShapeComponent (playerModels[i]);
scoreLabels [i] = new TetrisLabelComponent (playerModels[i]);
// Add next shape / labels
sizes = new double [][] {{5, fill, 5}, {5, pref, 5, fill, 5, pref, 5}};
JogrePanel panel = new JogrePanel (sizes);
panel.add (new PlayerComponent (conn, i, i == 0, false), i == 0 ? "1,1,l,t" : "1,1,r,t");
panel.add (scoreLabels[i], "1,3,c,b");
panel.add (nextShapes[i], "1,5,c,c");
panel.setBorder(BorderFactory.createEtchedBorder());
// Add GUI items to game panel
add (gameGrids[i], "" + (i * 6) + 1 + ",1");
add (panel, "" + ((i * 2) + 3) + ",1");
}
}
示例15: GoButtonPanel
/**
* Constructor to a go button panel.
*/
public GoButtonPanel (GoModel model, GoController controller) {
this.model = model;
model.addObserver (this);
controller.getTable().getPlayerList().addObserver(this);
this.controller = controller;
// Set up layout
double pref = TableLayout.PREFERRED;
double [][] sizes = new double [][] {{pref, 5, pref, 5, pref}, {pref}};
setLayout(new TableLayout (sizes));
// Create and add buttons
GameLabels labels = GameLabels.getInstance();
passButton = new JogreButton (labels.get(PASS));
happyButton = new JogreButton (labels.get(HAPPY));
unhappyButton = new JogreButton (labels.get(UNHAPPY));
// Add listeners
passButton.setName(PASS);
happyButton.setName(HAPPY);
unhappyButton.setName(UNHAPPY);
passButton.addActionListener(this);
happyButton.addActionListener(this);
unhappyButton.addActionListener(this);
// Add items to panel
add (passButton, "0,0");
add (happyButton, "2,0");
add (unhappyButton, "4,0");
}