项目:jaer
文件:JAERDataViewer.java
/** Creates new form JAERDataViewer */
public JAERDataViewer(String title) {
initComponents();
this.setTitle(title);
pnlGraph = new GraPHPanel();
pnlGraph.setBackground(new java.awt.Color(255,255,255));
pnlGraph.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0,0)));
pnlGraphContainer.setLayout(new GridLayout(0,1));
pnlGraph.setUpdateEvent(new GraPHPanelUpdateEvent() {
public void update() {
updateAxeBoxes();
}
});
pnlGraphContainer.add(pnlGraph);
pnlGraphContainer.revalidate();
pnlGraphContainer.repaint();
pnlGraph.setResizeX(false);
pnlGraph.setResizeY(true);
updateAxeBoxes();
periodicUpdate(true);
tblData.setModel(tabledata);
}
public FirstPassageTimetest(){
super(new GridLayout(1,2));
int dbscanMeter = 500;
loadRealWorldData(new distanceWithUnit(dbscanMeter,SpatialdistanceUnit.Meter));
HashMap<Long,Double> values = null;
values = firstPassageTimeCalculationtest();
double[][] plotValues = new double [values.keySet().size()][2];
int index=0;
for(Entry<Long,Double> entry:values.entrySet()){
plotValues[index][0] = entry.getKey();
plotValues[index][1] = entry.getValue();
index++;
}
PlotCanvas canvas = LinePlot.plot("First passage time",plotValues,Line.Style.soLID,Color.RED);
canvas.setTitle("First passage time (DBSCAN=" + dbscanMeter + "m)");
canvas.setAxisLabels("t (hour)","Fpt (t)");
add(canvas);
}
/**
* Creates new form FStandAdvance
*/
public FInfoDialog(java.awt.Frame parent,boolean modal) {
super(parent,modal);
infoDialog = this;
initComponents();
if (WelcomeParams.getInstance().btnFont != null) {
buttonBack.setFont(WelcomeParams.getInstance().btnFont);
buttonInRoot.setFont(WelcomeParams.getInstance().btnFont);
buttonPrint.setFont(WelcomeParams.getInstance().btnFont);
jButton2.setFont(WelcomeParams.getInstance().btnFont);
}
//На верхней панели пункта регистрации,там где заголовок и картинка в углу,можно вывести вэб-контент по URL. Оставьте пустым если не требуется
if (!WelcomeParams.getInstance().topURL.isEmpty()) {
panelUp.removeAll();
final browserFX bro = new browserFX();
final GridLayout gl = new GridLayout(1,1);
panelUp.setLayout(gl);
panelUp.add(bro);
bro.load(Uses.prepareAbsolutPathForImg(WelcomeParams.getInstance().topURL));
}
}
public browserFX() {
javafxPanel = new JFXPanel();
GridLayout gl = new GridLayout(1,1);
setLayout(gl);
add(javafxPanel,BorderLayout.CENTER);
try {
Thread.sleep(3000);
} catch (InterruptedException ex) {
}
Platform.runLater(() -> {
bro = new browser();
bro.getWebEngine().setJavaScriptEnabled(true);
Scene scene = new Scene(bro,750,500,Color.web("#666970"));
javafxPanel.setScene(scene);
ready = true;
});
}
项目:geomapapp
文件:GMAProfile.java
void initSave() {
savePanel = new JPanel(new GridLayout(0,1));
savePanel.setBorder( BorderFactory.createTitledBorder("Save Options"));
ButtonGroup gp = new ButtonGroup();
savetoFile = new JToggleButton("Save ASCII table");
savePanel.add( savetoFile );
gp.add( savetoFile );
savetoClipboard = new JToggleButton("copy to clipboard");
savePanel.add( savetoClipboard );
gp.add( savetoClipboard );
saveJPEG = new JToggleButton("Save JPEG image");
savePanel.add( saveJPEG );
gp.add( saveJPEG );
savePNG = new JToggleButton("Save PNG image");
savePanel.add( savePNG );
gp.add( savePNG );
print = new JToggleButton("Print");
savePanel.add( print );
gp.add( print );
}
项目:ramus
文件:SectorNameEditor.java
private Component getReplacemetPanel() {
JPanel group = new JPanel(new GridLayout(0,1));
group.setBorder(BorderFactory.createTitledBorder(ResourceLoader
.getString("ArrowReplacementType.name")));
group.add(safe = new JRadioButton("ArrowReplacementType.safe"));
group.add(children = new JRadioButton("ArrowReplacementType.branching"));
group.add(all = new JRadioButton("ArrowReplacementType.everywhere"));
safe.setSelected(true);
ButtonGroup g = new ButtonGroup();
g.add(children);
g.add(all);
g.add(safe);
setReplaceEnable(false);
return group;
}
项目:incubator-netbeans
文件:FilesModifiedConfirmation.java
public FilesModifiedConfirmation(SaveCookie[] saveCookies) {
btnSaveAll = createSaveAllButton();
btnSave = createSaveButton();
Mnemonics.setLocalizedText(btnSaveAll,getinitialSaveAllButtonText());
Mnemonics.setLocalizedText(btnSave,getinitialSaveButtonText());
JScrollPane scrollPane
= new JScrollPane(list = createFilesList(saveCookies));
if (!listModel.isEmpty()) {
list.setSelectedindex(0);
} else {
updateSaveButtonState();
}
JComponent panel = new JPanel(new GridLayout(1,1));
panel.add(scrollPane);
panel.setBorder(BorderFactory.createEmptyBorder(12,12,12));
mainComponent = panel;
}
项目:ramus
文件:StatusPanel.java
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
double[][] size = {{5,TableLayout.FILL,5},{5,5}};
this.setLayout(new TableLayout(size));
final GridLayout gridLayout3 = new GridLayout();
JPanel child = new JPanel(gridLayout3);
this.setSize(351,105);
gridLayout3.setRows(3);
gridLayout3.setColumns(2);
gridLayout3.setHgap(5);
gridLayout3.setVgap(5);
child.add(getJRadioButton(),null);
child.add(getJRadioButton1(),null);
child.add(getJRadioButton2(),null);
child.add(getJRadioButton3(),null);
child.add(getJRadioButton4(),null);
child.add(getJTextField(),null);
this.add(child,"1,1");
}
/**
* Create the panel.
*/
public VisualPanelcopyOptions() {
setLayout(new GridLayout(0,1,0));
copyFont = new JCheckBox("Visual.copyFont");
copyFont.setSelected(true);
add(copyFont);
copyBackground = new JCheckBox("Visual.copyBackground");
copyBackground.setSelected(true);
add(copyBackground);
copyForeground = new JCheckBox("Visual.copyForeground");
copyForeground.setSelected(true);
add(copyForeground);
copySize = new JCheckBox("Visual.copySize");
copySize.setSelected(true);
add(copySize);
}
项目:rapidminer
文件:ProcessExecutionResultOverview.java
/**
* Removes and adds the single result blocks according to the current width.
*/
private void redoLayout() {
resultPanel.removeAll();
if (expanded) {
int curWidth = parent.getSize().width;
int relevantWidth = SingleResultOverview.MIN_WIDTH + 25;
int xCount = curWidth / relevantWidth;
int yCount = (int) Math.ceil((double) results.size() / xCount);
resultPanel.setLayout(new GridLayout(yCount,xCount));
for (SingleResultOverview overview : results) {
resultPanel.add(overview);
}
}
revalidate();
}
项目:bhattiprolu-pad
文件:BhattiproluPad.java
public BhattiproluPad() {
mainFrame = new JFrame("Bhattiprolu Pad - Now,type in Telugu easily");
mainFrame.setSize(800,800);
mainFrame.setLayout(new GridLayout(3,1));
headLabel = new JLabel("Bhattiprolu Pad 0.1",JLabel.CENTER);
contentLabel = new JLabel("Empty",JLabel.CENTER);
mainPanel = new JPanel();
mainPanel.setLayout(new FlowLayout());
headLabel.setFont(englishFont);
contentLabel.setFont(teluguFont);
mainFrame.add(headLabel);
mainFrame.add(mainPanel);
mainFrame.add(contentLabel);
mainFrame.setVisible(true);
mainFrame.setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);
}
private void initComponents() {
Box vBox = Box.createVerticalBox();
Box hBox = Box.createHorizontalBox();
synView = new JTextPane();
synView.setContentType("text/html");
synView.setEditable(false);
synScroll = new JScrollPane(synView);
synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
vBox.add(Box.createVerticalStrut(30));
vBox.add(hBox);
vBox.add(Box.createVerticalStrut(30));
hBox.add(Box.createHorizontalStrut(20));
hBox.add(synScroll);
hBox.add(Box.createHorizontalStrut(20));
this.setLayout(new GridLayout(1,1));
this.add(vBox);
}
项目:geomapapp
文件:XYSave.java
void initSave() {
savePanel = new JPanel(new GridLayout(0,1));
savePanel.setBorder( BorderFactory.createTitledBorder("Save Options"));
ButtonGroup gp = new ButtonGroup();
savetoFile = new JToggleButton("Save ASCII table");
savePanel.add( savetoFile );
gp.add( savetoFile );
savetoClipboard = new JToggleButton("copy to clipboard");
savePanel.add( savetoClipboard );
gp.add( savetoClipboard );
saveJPEG = new JToggleButton("Save JPEG image");
savePanel.add( saveJPEG );
gp.add( saveJPEG );
savePNG = new JToggleButton("Save PNG image");
savePanel.add( savePNG );
gp.add( savePNG );
savetoExcel = new JToggleButton("Save Excel table");
savePanel.add( savetoExcel );
gp.add( savetoExcel );
print = new JToggleButton("Print");
savePanel.add( print );
gp.add( print );
}
项目:Equella
文件:AbstractTreeEditor.java
public AbstractTreeEditor()
{
tree = createTree();
tree.addTreeSelectionListener(this);
tree.setPreferredSize(new Dimension(325,0));
tree.setMinimumSize(new Dimension(325,0));
// Ensure the root nodes start loading
tree.loadChildren(tree.getRootNode());
editArea = new JPanel(new GridLayout(1,1));
AppletGuiUtils.removeBordersFromSplitPane(this);
setorientation(JSplitPane.HORIZONTAL_SPLIT);
setContinuousLayout(true);
setResizeWeight(0.05);
add(tree,JSplitPane.LEFT);
add(editArea,JSplitPane.RIGHT);
noSelectionEditor = new BasicmessageEditor(
CurrentLocale.get("com.tle.admin.gui.common.tree.nodeeditor.nonodeselected"));
showTreeNodeEditor(noSelectionEditor);
}
项目:jmt
文件:SectorsTextualPanel.java
private void initComponents() {
Box vBox = Box.createVerticalBox();
Box hBox = Box.createHorizontalBox();
synView = new JTextPane();
synView.setContentType("text/html");
synView.setEditable(false);
synScroll = new JScrollPane(synView);
synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
vBox.add(Box.createVerticalStrut(30));
vBox.add(hBox);
vBox.add(Box.createVerticalStrut(30));
hBox.add(Box.createHorizontalStrut(20));
hBox.add(synScroll);
hBox.add(Box.createHorizontalStrut(20));
this.setLayout(new GridLayout(1,1));
this.add(vBox);
synView
.setText("<html><body><center><font face=\"bold\" size=\"3\">Saturation Sectors will be here displayed once you solve the model.</font></center></body></html>");
}
项目:Equella
文件:AdminToolList.java
protected JPanel createButtonsPanel()
{
List<JButton> buttons = createButtons();
int count = buttons.size();
int maxPerRow = 3;
int cols = count < maxPerRow ? count : maxPerRow;
int rows = (int) Math.ceil((double) count / (double) maxPerRow);
JPanel content = new JPanel(new GridLayout(rows,cols));
for( JButton button : buttons )
{
content.add(button);
}
return content;
}
项目:Sunrin2017
文件:Swing03.java
public Swing03() {
setTitle("GridLayout");
setSize(200,200);
setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new GridLayout(3,2));
c.add(new JButton("Btn1"));
c.add(new JButton("Btn2"));
c.add(new JButton("Btn3"));
c.add(new JButton("Btn4"));
c.add(new JButton("Btn5"));
c.add(new JButton("Btn6"));
setVisible(true);
}
项目:NovelJ
文件:SettingsWindow_Windows.java
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100,100,450,300);
frame.setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new GridLayout(1,0));
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
frame.getContentPane().add(tabbedPane);
JScrollPane scrollPane = new JScrollPane();
tabbedPane.addTab("New tab",null,scrollPane,null);
JScrollPane scrollPane_1 = new JScrollPane();
tabbedPane.addTab("New tab",scrollPane_1,null);
}
项目:QN-ACTR-Release
文件:KMeanScatterPanelChoose.java
public KMeanScatterPanelChoose(WorkloadAnalysisSession m) {
super(new BorderLayout());
setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED),"Scatter Clustering"));
model = (ModelWorkloadAnalysis) m.getDataModel();
this.session = m;
varXCombo = new JComboBox(model.getMatrix().getvariableNames());
varyCombo = new JComboBox(model.getMatrix().getvariableNames());
varXCombo.setSelectedindex(0);
varyCombo.setSelectedindex(1);
JButton vis = new JButton(VIS_SCATTER);
JPanel combos = new JPanel(new GridLayout(1,2,5,0));
combos.add(varXCombo);
combos.add(varyCombo);
add(combos,BorderLayout.norTH);
add(vis,BorderLayout.soUTH);
}
项目:trashjam2017
文件:AppletGameContainer.java
/**
* Create a new panel to display the console output
*
* @param e The exception causing the console to be displayed
*/
public ConsolePanel(Exception e) {
setLayout(new BorderLayout());
setBackground(Color.black);
setForeground(Color.white);
Font consoleFont = new Font("Arial",Font.BOLD,14);
Label slickLabel = new Label("SLICK CONSOLE",Label.CENTER);
slickLabel.setFont(consoleFont);
add(slickLabel,BorderLayout.PAGE_START);
StringWriter sw = new StringWriter();
e.printstacktrace(new PrintWriter(sw));
textArea.setText(sw.toString());
textArea.setEditable(false);
add(textArea,BorderLayout.CENTER);
// add a border on both sides of the console
add(new Panel(),BorderLayout.LINE_START);
add(new Panel(),BorderLayout.LINE_END);
Panel bottomPanel = new Panel();
bottomPanel.setLayout(new GridLayout(0,1));
Label infoLabel1 = new Label("An error occured while running the applet.",Label.CENTER);
Label infoLabel2 = new Label("Plese contact support to resolve this issue.",Label.CENTER);
infoLabel1.setFont(consoleFont);
infoLabel2.setFont(consoleFont);
bottomPanel.add(infoLabel1);
bottomPanel.add(infoLabel2);
add(bottomPanel,BorderLayout.PAGE_END);
}
项目:JAddOn
文件:JLogin.java
public JLogin(Component c) {
StaticStandard.setLogin(this);
dialog.setModal(true);
dialog.setPreferredSize(new Dimension(400,150));
setStandardNames();
setStandardActionListeners();
//input_panel.setLayout(new BoxLayout(input_panel,BoxLayout.Y_AXIS));
input_panel.setLayout(new GridLayout(2,2));
pw_panel.setLayout(new BoxLayout(pw_panel,BoxLayout.X_AXIS));
user_panel.setLayout(new BoxLayout(user_panel,BoxLayout.X_AXIS));
/*
pw_panel.add(pw_label);
pw_panel.add(pw);
user_panel.add(user_label);
user_panel.add(user);
*/
input_panel.add(user_label);
input_panel.add(user);
input_panel.add(pw_label);
input_panel.add(pw);
dialog.setDefaultCloSEOperation(jdialog.disPOSE_ON_CLOSE);
dialog.setLayout(new BorderLayout());
button_panel.add(login);
button_panel.add(cancel);
//input_panel.add(user_panel);
//input_panel.add(pw_panel);
dialog.add(input_panel,BorderLayout.CENTER);
dialog.add(button_panel,BorderLayout.soUTH);
dialog.pack();
setRelativeto(c);
}
项目:litiengine
文件:AssetPanel.java
public AssetPanel() {
this.gridLayout = new GridLayout(3,COLUMNS);
this.gridLayout.setVgap(5);
this.gridLayout.setHgap(5);
this.setLayout(this.gridLayout);
this.setBorder(new EmptyBorder(5,5));
this.setBackground(Color.DARK_GRAY);
}
项目:geomapapp
文件:ShapeSuite.java
public String getURLString() {
JTextField txt = new JTextField(60);
JPanel panel = new JPanel(new GridLayout(2,0));
panel.add(new JLabel("Enter URL (example: \"http://www.ldeo.columbia.edu/~akm/shape_files/WF2004_T741.shp\")"));
panel.add(txt);
int ok = JOptionPane.showConfirmDialog((JFrame)map.getTopLevelAncestor(),panel,"enter URL",JOptionPane.OK_CANCEL_OPTION);
if( ok==JOptionPane.CANCEL_OPTION) return null;
return txt.getText();
}
项目:smile_1.5.0_java7
文件:IsoMapDemo.java
@Override
public JComponent learn() {
JPanel pane = new JPanel(new GridLayout(1,2));
double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
if (data.length > 1000) {
double[][] x = new double[1000][];
for (int i = 0; i < 1000; i++)
x[i] = data[i];
data = x;
}
long clock = System.currentTimeMillis();
IsoMap isomap = new IsoMap(data,k);
System.out.format("Learn IsoMap from %d samples in %dms\n",data.length,System.currentTimeMillis() - clock);
double[][] y = isomap.getCoordinates();
PlotCanvas plot = new PlotCanvas(Math.colMin(y),Math.colMax(y));
plot.points(y,'o',Color.RED);
int n = y.length;
Graph graph = isomap.getNearestNeighborgraph();
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
if (graph.hasEdge(i,j)) {
plot.line(y[i],y[j]);
}
}
}
plot.setTitle("IsoMap");
pane.add(plot);
return pane;
}
项目:GIFKR
文件:SaveFrame.java
public SaveFrame(Animation animation,Progressdisplay d) {
super("Save");
this.animation = animation;
this.d = d;
initializeComponents();
addActionListeners();
setLayout(new GridBagLayout());
GridBagConstraints gbc = ViewUtils.createGBC();
JPanel spinPanel = new JPanel(new GridLayout(3,2));
spinPanel.add(new JLabel("Width:"));
spinPanel.add(widthSpinner);
spinPanel.add(new JLabel("Height:"));
spinPanel.add(heightSpinner);
spinPanel.add(frameDelayLabel);
spinPanel.add(frameDelaySpinner);
add(spinPanel,gbc);
gbc.gridy++;
JLabel noteLabel = new JLabel("Filename conflicts will be resolved automatically");
noteLabel.setFont(noteLabel.getFont().deriveFont(noteLabel.getFont().getSize() - 2f));
add(noteLabel,gbc);
gbc.gridy++;
add(chooser,gbc);
pack();
}
项目:2D-Elliptic-Mesh-Generator
文件:DataSelectPanel.java
public DataSelectPanel(Object[][] data,int dimension,String... parametersNames) {
_data = data;
_dimension = dimension;
_parametersNames = parametersNames;
if (_dimension > parametersNames.length) {
throw new IllegalArgumentException("Number of parameters must be > to dimension=" + _dimension);
}
setLayout(new GridLayout(_parametersNames.length /*+ 1*/,1));
//JPanel title = new JPanel();
//title.setLayout(new GridLayout(1,2));
//title.add(new JLabel("Variable"));
//title.add(new JLabel("Axis / Parameter"));
//add(title);
if (_dimension == 0) {
buildrows();
} else if (_dimension == 1) {
buildrows(0);
} else if (_dimension == 2) {
buildrows(0,1);
} else if (_dimension == 3) {
buildrows(0,2);
}
fireSelectedDataChanged("init");
}
/**
* Add a list of radio buttons,representing default,generally used,values
* for the DPI.
*/
private void addDPIDefaultVals() {
// set the layout of the panel,based on the amount of elements to be displayed on it
jPDefaultValues.setLayout(new GridLayout(DPI_VALUES.length,1));
for (int index = 0; index < DPI_VALUES.length; index++) {
String text = DPI_VALUES[index] + " DPI";
// create a radio button with the given text
JRadioButton jrbDPIValues = new JRadioButton(text);
// set its action command to a number for easier usage later (to retrieve the value of the DPI)
jrbDPIValues.setActionCommand(Integer.toString(DPI_VALUES[index]));
// add action listener to synchronize the text field with the radio buttons
jrbDPIValues.addActionListener(e -> jFTFDPIValue.setValue(Integer.parseInt(bgScreenDPIs.getSelection().getActionCommand())));
// add mouse listener to display the help message when the mouse is on top of the radio buttons
jrbDPIValues.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseEntered(java.awt.event.MouseEvent evt) {
jPDefaultValuesMouseEntered(evt);
}
});
jrbDPIValues.setBackground(Color.white);
// add the radio button to the button group
bgScreenDPIs.add(jrbDPIValues);
// add the radio button to the panel displaying it
jPDefaultValues.add(jrbDPIValues);
// select the radio button which has the same value as the user preffered one (if any)
if (DPI_VALUES[index] == userPreferences.getPreferredDPI()) {
jrbDPIValues.setSelected(true);
jFTFDPIValue.setValue(DPI_VALUES[index]);
}
}
}
/**
* Execute the mds algorithm and return a swing JComponent representing
* the clusters.
*/
public JComponent learn() {
JPanel pane = new JPanel(new GridLayout(1,2));
double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
String[] labels = dataset[datasetIndex].toArray(new String[dataset[datasetIndex].size()]);
if (labels[0] == null) {
Attribute[] attr = dataset[datasetIndex].attributes();
labels = new String[attr.length];
for (int i = 0; i < labels.length; i++) {
labels[i] = attr[i].getName();
}
}
long clock = System.currentTimeMillis();
Isotonicmds isomds = new Isotonicmds(data,2);
System.out.format("Learn Kruskal's Nonmetric mds (k=2) from %d samples in %dms\n",System.currentTimeMillis()-clock);
PlotCanvas plot = ScatterPlot.plot(isomds.getCoordinates(),labels);
plot.setTitle("Kruskal's Nonmetric mds (k = 2)");
pane.add(plot);
clock = System.currentTimeMillis();
isomds = new Isotonicmds(data,3);
System.out.format("Learn Kruskal's Nonmetric mds (k=3) from %d samples in %dms\n",System.currentTimeMillis()-clock);
plot = ScatterPlot.plot(isomds.getCoordinates(),labels);
plot.setTitle("Kruskal's Nonmetric mds (k = 3)");
pane.add(plot);
return pane;
}
项目:LivroJavaComoProgramar10Edicao
文件:TicTacToeClient.java
public TicTacToeClient(String host)
{
ticTacToeHost = host; // set name of server
displayArea = new JTextArea(4,30); // set up JTextArea
displayArea.setEditable(false);
add(new JScrollPane(displayArea),BorderLayout.soUTH);
boardPanel = new JPanel(); // set up panel for squares in board
boardPanel.setLayout(new GridLayout(3,3,0));
board = new Square[3][3]; // create board
// loop over the rows in the board
for (int row = 0; row < board.length; row++)
{
// loop over the columns in the board
for (int column = 0; column < board[row].length; column++)
{
// create square
board[row][column] = new Square(" ",row * 3 + column);
boardPanel.add(board[row][column]); // add square
}
}
idField = new JTextField(); // set up textfield
idField.setEditable(false);
add(idField,BorderLayout.norTH);
panel2 = new JPanel(); // set up panel to contain boardPanel
panel2.add(boardPanel,BorderLayout.CENTER); // add board panel
add(panel2,BorderLayout.CENTER); // add container panel
setSize(300,225); // set size of window
setVisible(true); // show window
startClient();
}
项目:knime-activelearning
文件:ButtonList.java
/**
* Contructor with ClassModel Initializes ClassModel directly via the
* constructor.
*
* @param classModel
* the ClassModel
* @param maxRows
* maximum number of buttons per column
*/
public ButtonList(final ClassModel classModel,final int maxRows) {
super();
m_maxRows = maxRows;
m_panels = new ArrayList<>();
m_buttons = new ArrayList<>();
m_classModel = classModel;
setLayout(new GridLayout(1,3));
recreateButtonList();
}
项目:incubator-netbeans
文件:PopupPane.java
public PopupPane() {
listComponents = new HashSet<ListComponent>();
view = new JPanel();
GridLayout grid = new GridLayout(0,1);
grid.setHgap(0);
grid.setVgap(0);
view.setLayout(grid);
view.setBorder(BorderFactory.createEmptyBorder());
setName("progresspopup"); //NOI18N
setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
setViewportView(view);
setFocusable(true);
setRequestFocusEnabled(true);
Action down = new MoveDownAction();
getActionMap().put("Move-Down",down);
getInputMap().put(Keystroke.getKeystroke(KeyEvent.VK_DOWN,0),"Move-Down");
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(Keystroke.getKeystroke(KeyEvent.VK_DOWN,"Move-Down");
Action up = new MoveUpAction();
getActionMap().put("Move-Up",up);
getInputMap().put(Keystroke.getKeystroke(KeyEvent.VK_UP,"Move-Up");
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(Keystroke.getKeystroke(KeyEvent.VK_UP,"Move-Up");
Action cancel = new CancelAction();
getActionMap().put("Cancel-Task",cancel);
getInputMap().put(Keystroke.getKeystroke(KeyEvent.VK_DELETE,"Cancel-Task");
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(Keystroke.getKeystroke(KeyEvent.VK_DELETE,"Cancel-Task");
Action select = new SelectAction();
getActionMap().put("select-task",select);
getInputMap().put(Keystroke.getKeystroke(KeyEvent.VK_SPACE,"select-task");
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(Keystroke.getKeystroke(KeyEvent.VK_SPACE,"select-task");
setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
项目:openjdk-jdk10
文件:JSplitPaneOverlapping.java
protected void prepareControls() {
JFrame frame = new JFrame("SplitPane Mixing");
JPanel p = new JPanel(new GridLayout());
p.setPreferredSize(new Dimension(500,500));
propagateAWTControls(p);
sp1 = new JScrollPane(p);
JButton button = new JButton("JButton");
button.setBackground(Color.RED);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
clicked = true;
}
});
sp2 = new JScrollPane(button);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,sp1,sp2);
splitPane.setonetouchExpandable(false);
splitPane.setDividerLocation(150);
splitPane.setPreferredSize(new Dimension(400,200));
frame.getContentPane().add(splitPane);
frame.pack();
frame.setVisible(true);
}
项目:ABM-adaptive-tolerance
文件:MigFrame.java
public MigFrame(World world,EventManager event,int[] rules)
{
super("MigScape 3.0"); // creates frame,the constructor uses a string argument for the frame title
JPanel mainPanel = new JPanel(new GridLayout(5,5));
grid = new Grid(world,false);
gridF = new Grid(world,true);
ui = new UserControls(grid,event,rules);
para = new Parameters(event,rules);
mainPanel.add(grid,BorderLayout.CENTER);
mainPanel.add(ui,BorderLayout.norTH);
mainPanel.add(para,BorderLayout.soUTH);
mainPanel.setSize(world.getSizeX()*10,world.getSizeY()*10);
grid.setSize(new Dimension(world.getSizeX()*10,world.getSizeY()*10));
gridF.setSize(new Dimension(world.getSizeX()*10,world.getSizeY()*10));
ui.setSize(new Dimension(world.getSizeY()*10,50));
para.setSize(new Dimension(world.getSizeY()*10,50));
this.add(grid,BorderLayout.CENTER);
this.add(gridF,BorderLayout.EAST);
this.add(ui,BorderLayout.norTH);
this.add(para,BorderLayout.soUTH);
this.validate();
setDefaultCloSEOperation(JFrame.HIDE_ON_CLOSE); // specifies what happens when user closes the frame. exit_on_close means the program will stop
grid.setBackground(Color.WHITE);
gridF.setBackground(Color.WHITE);
ui.setBackground(Color.WHITE);
para.setBackground(Color.WHITE);
}
项目:incubator-netbeans
文件:OpenFileAction.java
@Override
public boolean approve(File[] selectedFiles) {
/* check the files: */
List<String> errorMsgs = null;
for (int i = 0; i < selectedFiles.length; i++) {
String msgPatternRef = null;
File file = selectedFiles[i];
if (!file.exists()) {
msgPatternRef = "MSG_FileDoesNotExist"; //NOI18N
} else if (file.isDirectory()) {
msgPatternRef = "MSG_FileIsADirectory"; //NOI18N
} else if (!file.isFile()) {
msgPatternRef = "MSG_FileIsNotPlainFile"; //NOI18N
}
if (msgPatternRef == null) {
continue;
}
if (errorMsgs == null) {
errorMsgs = new ArrayList<String>(selectedFiles.length - i);
}
errorMsgs.add(NbBundle.getMessage(OpenFileAction.class,msgPatternRef,file.getName()));
}
if (errorMsgs == null) {
return true;
} else {
JPanel panel = new JPanel(
new GridLayout(errorMsgs.size(),2)); //gaps
for (String errMsg : errorMsgs) {
panel.add(new JLabel(errMsg));
}
Dialogdisplayer.getDefault().notify(
new NotifyDescriptor.Message(
panel,NotifyDescriptor.WARNING_MESSAGE));
return false;
}
}
项目:Equella
文件:NoTopicEditor.java
public NoTopicEditor(String message)
{
JLabel messageLabel = new JLabel(CurrentLocale.get(getKey("notopic.") + message));
messageLabel.setHorizontalAlignment(SwingConstants.CENTER);
setLayout(new GridLayout(1,1));
add(messageLabel);
}
项目:ants
文件:FoodView.java
public FoodView() {
setLayout(new GridLayout(3,5));
add(textID);
add(textPositionX);
add(textPositionY);
}
项目:rapidminer
文件:AverageVectorViewer.java
public AverageVectorViewer(AverageVector vector,IOContainer container) {
setLayout(new GridLayout(1,1));
this.vector = vector;
JPanel mainPanel = new JPanel();
GridBagLayout layout = new GridBagLayout();
mainPanel.setLayout(layout);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.insets = new Insets(11,11,11);
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1.0d;
c.weighty = 0.0d;
JLabel mainLabel = new JLabel("<html><h2>" + getName() + " (" + vector.size() + ")</h2></html>");
layout.setConstraints(mainLabel,c);
mainPanel.add(mainLabel);
for (int i = 0; i < vector.size(); i++) {
Averagable avg = vector.getAveragable(i);
Component visualizationComponent = ResultdisplayTools.createVisualizationComponent(avg,container,"Averagable");
layout.setConstraints(visualizationComponent,c);
mainPanel.add(visualizationComponent);
}
ExtendedJScrollPane scrollPane = new ExtendedJScrollPane(mainPanel);
scrollPane.setBorder(null);
add(scrollPane);
}
项目:FreeCol
文件:NationTypeDetailPanel.java
/**
* Builds the details panel for the given nation type.
*
* @param nationType - the IndianNationType
* @param panel the panel to use
*/
private void buildindianNationTypeDetail(IndianNationType nationType,JPanel panel) {
List<RandomChoice<UnitType>> skills = nationType.getSkills();
panel.setLayout(new MigLayout("wrap 2,gapx 20","",""));
JLabel name = Utility.localizedHeaderLabel(nationType,FontLibrary.FontSize.SMALL);
panel.add(name,"span,align center,wrap 40");
panel.add(Utility.localizedLabel("colopedia.nationType.aggression"));
panel.add(Utility.localizedLabel("colopedia.nationType."
+ nationType.getAggression().getKey()));
panel.add(Utility.localizedLabel("colopedia.nationType.settlementNumber"));
panel.add(Utility.localizedLabel("colopedia.nationType."
+ nationType.getNumberOfSettlements().getKey()));
panel.add(Utility.localizedLabel("colopedia.nationType.typeOfSettlements"));
panel.add(new JLabel(Messages.getName(nationType.getCapitalType()),new ImageIcon(getimageLibrary().getSettlementimage(nationType.getCapitalType())),SwingConstants.CENTER));
List<String> regionNames = new ArrayList<>();
for (String regionName : nationType.getRegions()) {
regionNames.add(Messages.getName(regionName));
}
panel.add(Utility.localizedLabel("colopedia.nationType.regions"));
panel.add(new JLabel(join(",",regionNames)));
panel.add(Utility.localizedLabel("colopedia.nationType.skills"),"top,newline 20");
GridLayout gridLayout = new GridLayout(0,2);
gridLayout.setHgap(10);
JPanel unitPanel = new JPanel(gridLayout);
unitPanel.setopaque(false);
for (RandomChoice<UnitType> choice : skills) {
unitPanel.add(getUnitButton(choice.getobject()));
}
panel.add(unitPanel);
}
项目:smile_1.5.0_java7
文件:FontChooser.java
private jdialog createDialog(Component parent) {
Frame frame = parent instanceof Frame ? (Frame) parent
: (Frame) SwingUtilities.getAncestorOfClass(Frame.class,parent);
jdialog dialog = new jdialog(frame,getMessage("SelectFont"),true);
Action okAction = new DialogoKAction(dialog);
Action cancelAction = new DialogCancelAction(dialog);
JButton okButton = new JButton(okAction);
okButton.setFont(DEFAULT_FONT);
JButton cancelButton = new JButton(cancelAction);
cancelButton.setFont(DEFAULT_FONT);
JPanel buttonsPanel = new JPanel();
buttonsPanel.setLayout(new GridLayout(2,1));
buttonsPanel.add(okButton);
buttonsPanel.add(cancelButton);
buttonsPanel.setBorder(BorderFactory.createEmptyBorder(25,10,10));
ActionMap actionMap = buttonsPanel.getActionMap();
actionMap.put(cancelAction.getValue(Action.DEFAULT),cancelAction);
actionMap.put(okAction.getValue(Action.DEFAULT),okAction);
InputMap inputMap = buttonsPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(Keystroke.getKeystroke("ESCAPE"),cancelAction.getValue(Action.DEFAULT));
inputMap.put(Keystroke.getKeystroke("ENTER"),okAction.getValue(Action.DEFAULT));
JPanel dialogEastPanel = new JPanel();
dialogEastPanel.setLayout(new BorderLayout());
dialogEastPanel.add(buttonsPanel,BorderLayout.norTH);
dialog.getContentPane().add(this,BorderLayout.CENTER);
dialog.getContentPane().add(dialogEastPanel,BorderLayout.EAST);
dialog.pack();
dialog.setLocationRelativeto(frame);
return dialog;
}
/**
* Initialize all gui objects
*/
private void initComponents() {
setLayout(new BorderLayout());
JPanel topPanel = new JPanel(new GridLayout(2,1));
topPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
JLabel label = new JLabel("Execution number: ");
final JSpinner spinner = new JSpinner();
spinner.setPreferredSize(DIM_SPINNER);
spinner.setValue(new Integer(1));
label.setLabelFor(spinner);
// Pack spinner and its label on top,while description is on the second line
JPanel tmp = new JPanel();
tmp.add(label);
tmp.add(spinner);
topPanel.add(tmp);
description.setHorizontalAlignment(SwingConstants.CENTER);
topPanel.add(description);
// Adds state change to spinner.
spinner.addchangelistener(new changelistener() {
public void stateChanged(ChangeEvent e) {
int i = ((Integer) spinner.getValue()).intValue();
if (i <= 0) {
i = 1;
}
if (i > model.getWhatIfValues().length) {
i = model.getWhatIfValues().length;
}
select(i - 1);
spinner.setValue(new Integer(i));
}
});
add(topPanel,BorderLayout.norTH);
add(tabber,BorderLayout.CENTER);
select(0);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。