类java.awt.GridLayout源码实例Demo

下面列出了怎么用java.awt.GridLayout的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: netbeans   文件: TreeTableMemoryLeakTest.java
@Override
public void run() {

    // create panel (implementing ExplorerManager.Provider) with TTV
    MyPanel panel = new MyPanel();
    panel.setLayout(new GridLayout(1, 2));
    ttv = new TreeTableView();
    panel.add(ttv);

    // set root and keep the same root
    panel.setExplorerManagerRoot(root);


    //comment the next line to make the test works
    ttv.expandNode(root);

    // remove child
    children.remove(new Node[]{child});
    root = null;
    children = null;
}
 
源代码2 项目: computational-economy   文件: HouseholdsPanel.java
public HouseholdsPanelForCurrency(final Currency currency) {
	this.currency = currency;

	setLayout(new GridLayout(0, 3));

	this.add(createUtilityPanel(currency));
	// this.add(createUtilityFunctionMechanicsPanel(currency));
	this.add(createIncomeConsumptionSavingPanel(currency));
	this.add(createConsumptionSavingRatePanel(currency));
	this.add(createWageDividendPanel(currency));
	this.add(createIncomeSourcePanel(currency));
	incomeDistributionChart = createIncomeDistributionPanel(currency);
	this.add(new ChartPanel(incomeDistributionChart));
	this.add(createLorenzCurvePanel(currency));
	this.add(createHouseholdBalanceSheetPanel(currency));
	this.add(createLabourHourSupplyPanel(currency));
	this.add(createPricingBehaviourMechanicsPanel(currency, GoodType.LABOURHOUR));

	ApplicationContext.getInstance().getModelRegistry()
			.getNationalEconomyModel(currency).householdsModel.incomeDistributionModel.registerListener(this);
	// no registration with the price and market depth model, as they
	// call listeners synchronously

	notifyListener();
}
 
源代码3 项目: Qora   文件: PasswordPane.java
public static String showUnlockWalletDialog()
{
	JPanel userPanel = new JPanel();
	userPanel.setLayout(new GridLayout(2,2));

	//Labels for the textfield components        
	JLabel passwordLbl = new JLabel("Enter wallet password:");
	JPasswordField passwordFld = new JPasswordField();

	//Add the components to the JPanel        
	userPanel.add(passwordLbl);
	userPanel.add(passwordFld);

	//As the JOptionPane accepts an object as the message
	//it allows us to use any component we like - in this case 
	//a JPanel containing the dialog components we want
	if(JOptionPane.showConfirmDialog(null, userPanel, "Unlock Wallet" ,JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION)
	{
		return new String(passwordFld.getPassword());
	}
	
	return "";
}
 
源代码4 项目: java-photoslibrary   文件: LoadingView.java
private LoadingView() {
  UIHelper.setFixedSize(this, LOADING_DIMENSION);
  setTitle("Loading");
  moveToCenter();
  setResizable(false);
  setAlwaysOnTop(true);
  setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

  JProgressBar progressBar = new JProgressBar();
  progressBar.setIndeterminate(true);

  JPanel panel = new JPanel();
  panel.setBorder(BORDER);
  panel.setLayout(new GridLayout(1 /* rows */, 1 /* cols */));
  panel.add(progressBar);

  add(panel);
}
 
源代码5 项目: binnavi   文件: CControlsPanel.java
/**
 * Creates a new control settings panel.
 *
 * @param settings Settings object that provides the graph settings to display.
 */
public CControlsPanel(final ZyGraphViewSettings settings) {
  super(new GridLayout(3, 1));
  setBorder(new TitledBorder("Controls"));

  CSettingsPanelBuilder.addComboBox(this,
      mouseWheelBehaviorBox,
      "Mousewheel Action" + ":",
      "Specifies whether the mousewheel is used for zooming or scrolling in graph windows.",
      new String[] {"Zoom", "Scroll"},
      settings.getMouseSettings().getMouseWheelAction().ordinal());

  CSettingsPanelBuilder.addDoubleSlider(this, m_tfScrollSensitivity, "Scroll Sensitivity" + ":",
      "Mouse sensitivity during scroll operations.",
      settings.getMouseSettings().getScrollSensitivity() / 5);

  CSettingsPanelBuilder.addDoubleSlider(this, m_tfZoomSensitivity, "Zoom Sensitivity" + ":",
      "Mouse sensitivity during zoom operations.",
      settings.getMouseSettings().getZoomSensitivity() / 5);
}
 
源代码6 项目: java-photoslibrary   文件: ShareAlbumToolPanel.java
private JTextArea getMetadataTextArea(Album album) {
  JTextArea metadataTextArea = new JTextArea();
  metadataTextArea.setBorder(METADATA_BORDER);
  metadataTextArea.setLayout(
      new GridLayout(2 /* rows */, 1 /* cols */, 0 /* unset hgap */, 10 /* vgap */));
  metadataTextArea.setEditable(false);
  metadataTextArea.setLineWrap(true);
  metadataTextArea.append(String.format("URL: %s", album.getProductUrl()));
  if (album.hasShareInfo()) {
    metadataTextArea.append(
        String.format("\nShare URL: %s", album.getShareInfo().getShareableUrl()));
    metadataTextArea.append(
        String.format("\nShare Token: %s", album.getShareInfo().getShareToken()));
  }
  return metadataTextArea;
}
 
源代码7 项目: netbeans   文件: DefaultPlugin.java
/**
 */
private static JComponent wrapDialogContent(JComponent comp,
                                            boolean selfResizing) {
    JComponent result;
    
    if ((comp.getBorder() != null) || selfResizing) {
        result = selfResizing ? new SelfResizingPanel() : new JPanel();
        result.setLayout(new GridLayout());
        result.add(comp);
    } else {
        result = comp;
    }
    result.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
    result.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_title_select_generator"));
    return result;
}
 
源代码8 项目: freecol   文件: MapEditorTransformPanel.java
/**
 * Creates a panel to choose a map transform.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public MapEditorTransformPanel(FreeColClient freeColClient) {
    super(freeColClient, null, new BorderLayout());

    listPanel = new JPanel(new GridLayout(2, 0));

    group = new ButtonGroup();
    //Add an invisible, move button to de-select all others
    group.add(new JToggleButton());
    buildList();

    JScrollPane sl = new JScrollPane(listPanel,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sl.getViewport().setOpaque(false);
    add(sl);
}
 
源代码9 项目: Spark   文件: RawPacketSender.java
public RawPacketSender() {

	_mainframe = new JFrame("Send Raw Packets");
	_mainframe.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE)
		.getImage());
	_mainpanel = new JPanel();
	_mainpanel.setLayout(new GridLayout(2, 1));
	_textarea = new JTextArea();
	_inputarea = new JTextArea();
	_textscroller = new JScrollPane(_textarea);
	_sendButton = new JButton("Send",
		SparkRes.getImageIcon(SparkRes.SMALL_CHECK));
	_clear = new JButton("Clear",
		SparkRes.getImageIcon(SparkRes.SMALL_DELETE));

	createGUI();

    }
 
源代码10 项目: java-photoslibrary   文件: SearchMediaItemView.java
/** Creates a border-layout panel with padding. */
private JPanel initializeContentPanel() {
  JPanel panel = new JPanel();
  panel.setLayout(new BorderLayout(0 /* hgap */, 20 /* vgap */));

  JScrollPane scrollPane =
      new JScrollPane(
          panel,
          JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
          JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  scrollPane.setBorder(UIHelper.NO_BORDER);

  JPanel outerPanel = new JPanel();
  outerPanel.setLayout(new GridLayout(1 /* rows */, 1 /* cols */));
  outerPanel.setBorder(CONTENT_BORDER);
  outerPanel.add(scrollPane);
  add(outerPanel, BorderLayout.CENTER);

  return panel;
}
 
源代码11 项目: netbeans   文件: DialogSupport.java
/** Create a panel with buttons that will be placed according
 * to the required alignment */
private JPanel createButtonPanel( JButton[] buttons, boolean sidebuttons ) {
    int count = buttons.length;
    
    JPanel outerPanel = new JPanel( new BorderLayout() );
    outerPanel.setBorder( new EmptyBorder( new Insets(
            sidebuttons ? 5 : 0, sidebuttons ? 0 : 5, 5, 5 ) ) );

    LayoutManager lm = new GridLayout( // GridLayout makes equal cells
            sidebuttons ? count : 1, sidebuttons ? 1 : count,  5, 5 );
        
    JPanel innerPanel = new JPanel( lm );
    
    for( int i = 0; i < count; i++ ) innerPanel.add( buttons[i] );
    
    outerPanel.add( innerPanel,
        sidebuttons ? BorderLayout.NORTH : BorderLayout.EAST ) ;
    return outerPanel;
}
 
源代码12 项目: pcgen   文件: PrintPreviewDialog.java
private PrintPreviewDialog(PCGenFrame frame)
{
	super(frame, true);
	this.frame = frame;
	this.character = frame.getSelectedCharacterRef().get();
	this.previewPanelParent = new JPanel(new GridLayout(1, 1));
	this.sheetBox = new JComboBox<>();
	this.progressBar = new JProgressBar();
	this.pageBox = new JComboBox<>();
	this.zoomBox = new JComboBox<>();
	this.zoomInButton = new JButton();
	this.zoomOutButton = new JButton();
	this.printButton = new JButton();
	this.cancelButton = new JButton();
	initComponents();
	initLayout();
	pack();
	new SheetLoader().execute();
}
 
源代码13 项目: hottub   文件: SelectionAutoscrollTest.java
void createObjects() {
    textArea = new TextArea( bigString() );
    robot = Util.createRobot();

    Panel panel = new Panel();
    panel.setLayout( new GridLayout(3,3) );

    for( int y=0; y<3; ++y ) {
        for( int x=0; x<3; ++x ) {
            if( x==1 && y==1 ) {
                panel.add( textArea );
            } else {
                panel.add( new Panel() );
            }
        }
    }

    Frame frame = new Frame( "TextArea cursor icon test" );
    frame.setSize( 300, 300 );
    frame.add( panel );
    frame.setVisible( true );
}
 
源代码14 项目: JavaMainRepo   文件: AFrame.java
public AFrame(String title) {
	super(title);
	contentPanel.setLayout(new GridLayout(0, 3, 0, 0));
	
	JPanel panel = new JPanel();
	contentPanel.add(panel);

	JPanel pan = new JPanel();
	contentPanel.add(pan);
	SpringLayout slPanel = new SpringLayout();
	pan.setLayout(slPanel);

	animalButton = new JButton("Animal");
	slPanel.putConstraint(SpringLayout.NORTH, animalButton, 65, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, animalButton, 93, SpringLayout.WEST, pan);
	pan.add(animalButton);

	employeeButton = new JButton("Employee");
	slPanel.putConstraint(SpringLayout.NORTH, employeeButton, 100, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, employeeButton, 93, SpringLayout.WEST, pan);
	pan.add(employeeButton);

	JPanel rightPanel = new JPanel();
	contentPanel.add(rightPanel);
	setVisible(true);
}
 
源代码15 项目: JavaMainRepo   文件: EmployeeFrame.java
/**
 * 
 * @param title
 *            The title of the frame.
 */
public EmployeeFrame(final String title) {
	super(title);
	contentPanel.setLayout(new GridLayout(0, 1, 0, 0));
	JPanel pan = new JPanel();
	contentPanel.add(pan);
	SpringLayout slPanel = new SpringLayout();
	pan.setLayout(slPanel);
	Caretaker = new JButton("Caretaker");
	slPanel.putConstraint(SpringLayout.NORTH, Caretaker, 180, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, Caretaker, 280, SpringLayout.WEST, pan);
	pan.add(Caretaker);
	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
源代码16 项目: birt   文件: Regression_119808.java
ControlPanel( Regression_119808 siv )
{
	this.siv = siv;

	setLayout( new GridLayout( 0, 1, 0, 0 ) );

	JPanel jp = new JPanel( );
	jp.setLayout( new FlowLayout( FlowLayout.LEFT, 3, 3 ) );

	jp.add( new JLabel( "Choose:" ) );//$NON-NLS-1$
	jcbModels = new JComboBox( );

	jcbModels.addItem( "Bar Chart" );
	jcbModels.setSelectedIndex( 0 );
	jp.add( jcbModels );

	jbUpdate = new JButton( "Update" );//$NON-NLS-1$
	jbUpdate.addActionListener( this );
	jp.add( jbUpdate );

	add( jp );
}
 
源代码17 项目: ApkToolPlus   文件: InterfacesGeneralPane.java
protected void setupComponent() {
	addButton = new JButton("Add interface");
	name = new JTextField(15);

	JPanel namePanel = new JPanel();
	namePanel.setLayout(new GridLayout(2, 1));
	namePanel.add(new JLabel("Interface name"));
	namePanel.add(name);
	add(namePanel);

	JPanel buttonPanel = new JPanel();
	buttonPanel.setLayout(new GridLayout(2, 1));
	
	buttonPanel.add(new JLabel(""));
	buttonPanel.add(addButton);
       Border simpleBorder = BorderFactory.createEtchedBorder();
       Border border = BorderFactory.createTitledBorder(simpleBorder,
               "Add interface");
	this.setBorder(border);		
	add(buttonPanel);
	addButton.addActionListener(this);
	addButton.setActionCommand("add");
}
 
源代码18 项目: rest-client   文件: OptionsEtcPanel.java
OptionsEtcPanel(){
    this.setLayout(new FlowLayout(FlowLayout.LEFT));
    jcb_indentResponse.setMnemonic('a');

    jcb_syntaxRequest.setToolTipText("Requires RESTClient restart!");
    jcb_syntaxResponse.setToolTipText("Requires RESTClient restart!");
    
    JPanel jp = new JPanel();
    jp.setLayout(new GridLayout(4, 1));
    
    jp.add(jcb_indentResponse);
    jp.add(jcb_syntaxRequest);
    jp.add(jcb_syntaxResponse);
    JPanel jp_scrollSpeed = new JPanel(new BorderLayout());
    JPanel jp_scrollSpeed_inner = new JPanel(new FlowLayout());
    jp_scrollSpeed_inner.add(new JLabel("Text areas scroll speed"));
    jp_scrollSpeed_inner.add(js_scrollSpeed);
    jp_scrollSpeed.add(BorderLayout.WEST, jp_scrollSpeed_inner);
    jp.add(jp_scrollSpeed);
    ((JSpinner.DefaultEditor)js_scrollSpeed.getEditor()).getTextField().setColumns(2);
    
    this.add(jp);
}
 
源代码19 项目: GpsPrune   文件: AudioTimestampSelector.java
/**
 * Create the GUI components
 * @param inTopLabelKey key for description label at top
 * @param inLowerLabelKey key for description label at bottom, if any
 */
private void createComponents(String inTopLabelKey, String inLowerLabelKey)
{
	setLayout(new BorderLayout());
	add(new JLabel(I18nManager.getText(inTopLabelKey)), BorderLayout.NORTH);
	// panel for the radio buttons
	JPanel gridPanel = new JPanel();
	gridPanel.setLayout(new GridLayout(0, 3, 15, 3));
	final String[] keys = {"beginning", "middle", "end"};
	ButtonGroup group = new ButtonGroup();
	for (int i=0; i<3; i++)
	{
		_radios[i] = new JRadioButton(I18nManager.getText("dialog.correlate.timestamp." + keys[i]));
		group.add(_radios[i]);
		gridPanel.add(_radios[i]);
	}
	_radios[0].setSelected(true);
	add(gridPanel, BorderLayout.CENTER);
	if (inLowerLabelKey != null) {
		add(new JLabel(I18nManager.getText(inLowerLabelKey)), BorderLayout.SOUTH);
	}
}
 
源代码20 项目: birt   文件: DataChartsViewer.java
ControlPanel( DataChartsViewer dcv )
{
	this.dcv = dcv;

	setLayout( new GridLayout( 0, 1, 0, 0 ) );

	JPanel jp = new JPanel( );
	jp.setLayout( new FlowLayout( FlowLayout.LEFT, 3, 3 ) );

	JLabel choose=new JLabel( "Choose:" );//$NON-NLS-1$
	choose.setDisplayedMnemonic( 'c' );
	jp.add( choose );
	jcbModels = new JComboBox( );

	jcbModels.addItem( "Min Slice" );//$NON-NLS-1$
	jcbModels.addItem( "Multiple Y Axis" );//$NON-NLS-1$
	jcbModels.addItem( "Multiple Y Series" );//$NON-NLS-1$
	jcbModels.addItem( "Big number Y Series" );//$NON-NLS-1$

	jcbModels.setSelectedIndex( 0 );
	choose.setLabelFor( jcbModels );
	jp.add( jcbModels );

	jbUpdate = new JButton( "Update" );//$NON-NLS-1$
	jbUpdate.setMnemonic( 'u' );
	jbUpdate.setToolTipText( "Update" );//$NON-NLS-1$
	jbUpdate.addActionListener( this );
	jp.add( jbUpdate );

	add( jp );
}
 
源代码21 项目: plugins   文件: FeedPanel.java
FeedPanel(FeedConfig config, Supplier<FeedResult> feedSupplier)
{
	super(true);
	this.config = config;
	this.feedSupplier = feedSupplier;

	setBorder(new EmptyBorder(10, 10, 10, 10));
	setBackground(ColorScheme.DARK_GRAY_COLOR);
	setLayout(new GridLayout(0, 1, 0, 4));
}
 
源代码22 项目: JByteMod-Beta   文件: PageEndPanel.java
public PageEndPanel() {
  this.pb = new JProgressBar() {
    @Override
    public void setValue(int n) {
      if (n == 100) {
        super.setValue(0);
        percent.setText("");
      } else {
        super.setValue(n);
        percent.setText(n + "%");
      }
    }
  };
  this.setLayout(new GridLayout(1, 4, 10, 10));
  this.setBorder(new EmptyBorder(3, 0, 0, 0));
  this.add(pb);
  this.add(percent = new JLabel());
  percent.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 13));
  label = new JLabel(copyright);
  label.setHorizontalAlignment(SwingConstants.RIGHT);
  label.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 13));
  this.add(label);
  memoryBar = new WebMemoryBar();
  memoryBar.setShowMaximumMemory(false);
  this.add(memoryBar);

}
 
源代码23 项目: mars-sim   文件: ExplorationCustomInfoPanel.java
/**
 * Constructor
 * @param siteName the site name.
 * @param completion the completion level.
 */
ExplorationSitePanel(String siteName, double completion) {
	// Use JPanel constructor.
	super();

	this.completion = completion;

	setLayout(new GridLayout(1, 2, 3, 3));

	WebPanel namePanel = new WebPanel(new FlowLayout(FlowLayout.RIGHT, 3, 3));
	namePanel.setAlignmentX(CENTER_ALIGNMENT);
	add(namePanel);

	WebLabel nameLabel = new WebLabel("  " + Conversion.capitalize(siteName), SwingConstants.RIGHT);
	nameLabel.setAlignmentX(CENTER_ALIGNMENT);
	namePanel.add(nameLabel);

	WebPanel barPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT, 3, 0));
	barPanel.setAlignmentX(CENTER_ALIGNMENT);
	add(barPanel);

	completionBar = new WebProgressBar(0, 100);
	completionBar.setAlignmentX(CENTER_ALIGNMENT);
	completionBar.setStringPainted(true);
	completionBar.setValue((int) (completion * 100D));
	barPanel.add(completionBar);
}
 
源代码24 项目: hottub   文件: CardTest.java
CardPanel(ActionListener actionListener) {
    listener = actionListener;
    setLayout(new CardLayout());
    add("one", create(new FlowLayout()));
    add("two", create(new BorderLayout()));
    add("three", create(new GridLayout(2, 2)));
    add("four", create(new BorderLayout(10, 10)));
    add("five", create(new FlowLayout(FlowLayout.LEFT, 10, 10)));
    add("six", create(new GridLayout(2, 2, 10, 10)));
}
 
源代码25 项目: Luyten   文件: JFontChooser.java
protected JDialog createDialog(Component parent) {
	Frame frame = parent instanceof Frame ? (Frame) parent
			: (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);
	JDialog dialog = new JDialog(frame, ("Select Font"), 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, 0, 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;
}
 
private void constructPanel(String[] values) {
	// constructing editors
	editors = new PropertyValueCellEditor[types.length];
	for (int i = 0; i < types.length; i++) {
		editors[i] = PropertyPanel.instantiateValueCellEditor(types[i], operator);
	}

	// building panel
	panel = new JPanel();
	panel.setFocusable(true);
	panel.setLayout(new GridLayout(1, editors.length));
	for (int i = 0; i < types.length; i++) {
		Component editorComponent = editors[i].getTableCellEditorComponent(null, values[i], false, 0, 0);

		if (editorComponent instanceof JComboBox) {
			if (((JComboBox<?>) editorComponent).isEditable()) {
				ComboBoxEditor editor = ((JComboBox<?>) editorComponent).getEditor();
				if (editor instanceof BasicComboBoxEditor) {
					editor.getEditorComponent().addFocusListener(focusListener);
				}
			} else {
				editorComponent.addFocusListener(focusListener);
			}
		} else if (editorComponent instanceof JPanel) {
			JPanel editorPanel = (JPanel) editorComponent;
			Component[] components = editorPanel.getComponents();
			for (Component comp : components) {
				comp.addFocusListener(focusListener);
			}
		} else {

			editorComponent.addFocusListener(focusListener);
		}
		panel.add(editorComponent);
		panel.addFocusListener(focusListener);
	}
}
 
源代码27 项目: jdk8u-jdk   文件: HoveringAndDraggingTest.java
public void start() {
    String[] instructions = new String[] {
        "1. Notice components in test window: main-panel, box-for-text,"
            +" 2 scroll-sliders, and 4 scroll-buttons.",
        "2. Hover mouse over box-for-text."
            +" Make sure, that mouse cursor is TextCursor (a.k.a. \"beam\").",
        "3. Hover mouse over each of components (see item 1), except for box-for-text."
            +" Make sure, that cursor is DefaultCursor (arrow).",
        "4. Drag mouse (using any mouse button) from box-for-text to every"
            +" component in item 1, and also outside application window."
            +" Make sure, that cursor remains TextCursor while mouse button is pressed.",
        "5. Repeat item 4 for each other component in item 1, except for box-for-text,"
            +" _but_ now make sure that cursor is DefaultCursor.",
        "6. If cursor behaves as described in items 2-3-4-5, then test passed; otherwise it failed."
    };
    Sysout.createDialogWithInstructions( instructions );

    Panel panel = new Panel();
    panel.setLayout( new GridLayout(3,3) );

    for( int y=0; y<3; ++y ) {
        for( int x=0; x<3; ++x ) {
            if( x==1 && y==1 ) {
                panel.add( new TextArea( bigString() ) );
            } else {
                panel.add( new Panel() );
            }
        }
    }

    Frame frame = new Frame( "TextArea cursor icon test" );
    frame.setSize( 300, 300 );
    frame.add( panel );
    frame.setVisible( true );
}
 
private void initTemplatesPanel() {
    templatePanel = new TemplatePanelVisual();
    templatePanelHolder.setLayout(new GridLayout(1, 1));
    templatePanelHolder.add(templatePanel);
    templatePanel.setVisible(true);
    templatePanelHolder.setEnabled(false);
    repaint();
    revalidate();
    setVisibleTemplateInfo(false);
}
 
源代码29 项目: moa   文件: ImageTreePanel.java
/**
 * Constructor.
 * @param chart
 */
public ImageTreePanel(ImageChart chart[]) {
    super(new GridLayout(1, 0));
    this.chart = chart;
    //Create the nodes.
    DefaultMutableTreeNode top
            = new DefaultMutableTreeNode("Images");
    imgPanel = new JPanel();
    imgPanel.setLayout(new GridLayout(1, 0));
    createNodes(top);
    tree = new JTree(top);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
    tree.setSelectionRow(1);

    tree.addTreeSelectionListener(this);
    ImageIcon leafIcon = new ImageIcon("icon/img.png");
    if (leafIcon != null) {
        DefaultTreeCellRenderer renderer
                = new DefaultTreeCellRenderer();
        renderer.setLeafIcon(leafIcon);
        tree.setCellRenderer(renderer);
    }
    imgPanel.updateUI();
    JScrollPane treeView = new JScrollPane(tree);
    treeView.setMinimumSize(new Dimension(100, 50));

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.setTopComponent(treeView);
    splitPane.setBottomComponent(imgPanel);
    splitPane.setDividerLocation(100);
    splitPane.setPreferredSize(new Dimension(500, 300));
    add(splitPane);

}
 
源代码30 项目: openjdk-8   文件: XOperations.java
public XOperations(MBeansTab mbeansTab) {
    super(new GridLayout(1, 1));
    this.mbeansTab = mbeansTab;
    operationEntryTable = new Hashtable<JButton, OperationEntry>();
    ArrayList<NotificationListener> l =
            new ArrayList<NotificationListener>(1);
    notificationListenersList =
            Collections.synchronizedList(l);
}
 
 类所在包
 同包方法