当前位置: 首页>>代码示例>>Java>>正文


Java JPanel类代码示例

本文整理汇总了Java中javax.swing.JPanel的典型用法代码示例。如果您正苦于以下问题:Java JPanel类的具体用法?Java JPanel怎么用?Java JPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JPanel类属于javax.swing包,在下文中一共展示了JPanel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initComponents

import javax.swing.JPanel; //导入依赖的package包/类
protected void initComponents() {
  setTitle("Translate " + VASSAL.configure.ConfigureTree.getConfigureName((Configurable) target));
  JPanel mainPanel = new JPanel(new BorderLayout());
  /*
   * Place Language selector above Tree and Keys
   */
  mainPanel.add(getHeaderPanel(), BorderLayout.PAGE_START);
  mainPanel.add(buildMainPanel(), BorderLayout.CENTER);
  mainPanel.add(getButtonPanel(), BorderLayout.PAGE_END);
  add(mainPanel);
  pack();
  setLocationRelativeTo(getParent());
  setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
  addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
      cancel();
    }
  });
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:20,代码来源:TranslateWindow.java

示例2: print

import javax.swing.JPanel; //导入依赖的package包/类
@Override
public void print(Graphics pg) {

	JPanel printPanel = new JPanel() {

		private static final long serialVersionUID = 7315234075649335574L;

		@Override
		public void paintComponent(Graphics g) {
			Graphics2D g2 = (Graphics2D) g;
			plotEngine.getChartPanel().print(g2);
		}
	};
	Insets insets = plotEngine.getChartPanel().getInsets();
	int w = plotEngine.getChartPanel().getWidth() - insets.left - insets.right;
	int h = plotEngine.getChartPanel().getHeight() - insets.top - insets.bottom;
	printPanel.setSize(new Dimension(w, h));

	printPanel.print(pg);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:ChartConfigurationPanel.java

示例3: VormerkUI

import javax.swing.JPanel; //导入依赖的package包/类
/**
 * Initialisiert die Elemente der Benutzungsoberfläche.
 * 
 * @param kundenauflisterPanel Das UI-Panel des Kundenauflisters.
 * @param medienauflisterPanel Das UI-Panel des Medienauflisters.
 * @param mediendetailAnzeigerPanel Das UI-Panel des Mediendetailanzeigers.
 * 
 * @require (kundenauflisterPanel != null)
 * @require (medienauflisterPanel != null)
 * @require (kundendetailAnzeigerPanel != null)
 * @require (mediendetailAnzeigerPanel != null)
 */
public VormerkUI(JPanel kundenauflisterPanel, JPanel medienauflisterPanel,
        JPanel kundendetailAnzeigerPanel, JPanel mediendetailAnzeigerPanel)
{
    assert kundenauflisterPanel != null : "Vorbedingung verletzt: (kundenauflisterPanel != null)";
    assert medienauflisterPanel != null : "Vorbedingung verletzt: (medienauflisterPanel != null)";
    assert kundendetailAnzeigerPanel != null : "Vorbedingung verletzt: (kundendetailAnzeigerPanel != null)";
    assert mediendetailAnzeigerPanel != null : "Vorbedingung verletzt: (mediendetailAnzeigerPanel != null)";

    _kundenauflisterPanel = kundenauflisterPanel;
    _medienauflisterPanel = medienauflisterPanel;
    _mediendetailAnzeigerPanel = mediendetailAnzeigerPanel;
    _kundendetailAnzeigerPanel = kundendetailAnzeigerPanel;

    erzeugeHauptPanel();
    erzeugeAuflisterPanel();
    erzeugeAusleihePanel();
}
 
开发者ID:polemonium,项目名称:SE2Project,代码行数:30,代码来源:VormerkUI.java

示例4: createFirstTab

import javax.swing.JPanel; //导入依赖的package包/类
@Override
protected Component createFirstTab(JTabbedPane pane) {
    sectorRowsEditor = new SectorRowsEditor(dataPlugin, framework,
            framework.getAccessRules());
    sectorNameEditor = new SectorNameEditor(dataPlugin, framework,
            framework.getAccessRules()) {
        @Override
        protected void createReplacementPanel(JPanel ignoreMe) {
        }

        @Override
        public Stream getStream() {
            return sectorRowsEditor.getStream();
        }
    };
    sectorNameEditor.box.setVisible(false);
    sectorRowsEditor.setSectorNameEditor(sectorNameEditor);
    pane.addTab(ResourceLoader.getString("name"), sectorRowsEditor);
    return sectorNameEditor;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:21,代码来源:DFDSRoleOptionsDialog.java

示例5: makeContentPanel

import javax.swing.JPanel; //导入依赖的package包/类
/**
 * Creates the content panel consisting of a scrollable text area to display the EULA text and a
 * check box to accept it.
 */
private JComponent makeContentPanel() {
	JPanel panel = new JPanel();
	panel.setLayout(new BorderLayout());

	// add text area with scroll pane
	panel.add(this.scrollPane, BorderLayout.CENTER);
	// scroll to tohe top of the document
	SwingUtilities.invokeLater(new Runnable() {

		@Override
		public void run() {
			scrollPane.getVerticalScrollBar().setValue(0);
		}
	});

	// add check box to enable accept button
	panel.add(this.acceptCheckBox, BorderLayout.SOUTH);

	return panel;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:25,代码来源:EULADialog.java

示例6: getOutputPanel

import javax.swing.JPanel; //导入依赖的package包/类
private JPanel getOutputPanel(JTextArea area) {
	JPanel panel = getNewPanel();

	JScrollPane areapane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

	GridBagConstraints g = new GridBagConstraints();

	areapane.setViewportView(area);

	g.gridx = 0;
	g.gridy = 1;
	g.weightx = 1;
	g.weighty = 1;
	g.fill = GridBagConstraints.BOTH;
	panel.add(areapane, g);
	
	return panel;
}
 
开发者ID:privacyint,项目名称:thornsec-core,代码行数:19,代码来源:FullFrame.java

示例7: addButton

import javax.swing.JPanel; //导入依赖的package包/类
private JToggleButton addButton(final String value) {
    final int numBtns = m_buttons.size();

    if (numBtns >= (m_maxRows * m_panels.size())) {
        // create a new Panel
        final JPanel panel = new JPanel(new GridLayout(m_maxRows, 1));

        this.add(panel);

        m_panels.add(panel);
        m_lastPanel = panel;
    }
    // createButton and add this as itemListener
    final JToggleButton btn = new CustomToggleButton(value);
    btn.addActionListener(this);

    if (value.equals(ClassModel.NO_CLASS)) {
        btn.setText(m_defaultText);
    }

    m_lastPanel.add(btn); // add it to the last Panel

    m_buttons.add(btn);
    return btn;
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:26,代码来源:ToggleButtonList.java

示例8: createConnPanel

import javax.swing.JPanel; //导入依赖的package包/类
public JPanel createConnPanel() {
	JPanel con = new HorizontalPanel();
	
	JPanel connPanel = new HorizontalPanel();
	connPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "MQTT connection"));
	connPanel.add(serverAddr);
	connPanel.add(serverPort);
	connPanel.add(mqttVersion);
	connPanel.add(connShared);
	
	JPanel timeoutPannel = new HorizontalPanel();
	timeoutPannel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Timeout"));
	timeoutPannel.add(timeout);

	con.add(connPanel);
	con.add(timeoutPannel);
	return con;
}
 
开发者ID:emqtt,项目名称:mqtt-jmeter,代码行数:19,代码来源:CommonConnUI.java

示例9: addSeparator

import javax.swing.JPanel; //导入依赖的package包/类
public void addSeparator() {
    if (!UIUtils.isMetalLookAndFeel()) {
        super.addSeparator();
    } else {
        final JSeparator separator = new JSeparator(JSeparator.VERTICAL);
        final int WDTH = separator.getPreferredSize().width;
        final Dimension SIZE = new Dimension(new JToolBar.Separator().getSeparatorSize().width, 12);
        JPanel panel = new JPanel(null) {
            public Dimension getPreferredSize() { return SIZE; }
            public Dimension getMaximumSize() { return SIZE; }
            public Dimension getMinimumSize() { return SIZE; }

            public void doLayout() {
                int x = (getWidth() - WDTH) / 2;
                int y = (getHeight()- SIZE.height) / 2;
                separator.setBounds(x, y, WDTH, SIZE.height);
            }
        };
        panel.setOpaque(false);
        panel.add(separator);
        super.add(panel);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:GenericToolbar.java

示例10: createP3

import javax.swing.JPanel; //导入依赖的package包/类
JPanel createP3() {
	p3 = new JPanel(new BorderLayout());
	model = new DefaultListModel();
	list = new JList(model);
	list.setCellRenderer(new YTListRenderer());
	p3.add(new JScrollPane(list));
	Box box = Box.createHorizontalBox();
	box.add(Box.createHorizontalGlue());
	btnDwnld = new JButton("Download");
	btnDwnld.addActionListener(this);
	btnCancel = new JButton("Close");
	btnCancel.addActionListener(this);
	box.add(btnDwnld);
	box.add(Box.createHorizontalStrut(10));
	box.add(btnCancel);
	btnCancel.setPreferredSize(btnDwnld.getPreferredSize());
	box.add(Box.createHorizontalStrut(10));
	box.add(Box.createRigidArea(new Dimension(0, 40)));
	p3.add(box, BorderLayout.SOUTH);

	box.setOpaque(true);
	box.setBackground(StaticResource.titleColor);
	return p3;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:25,代码来源:YoutubeGrabberDlg.java

示例11: addProduction

import javax.swing.JPanel; //导入依赖的package包/类
private void addProduction(JPanel panel, Stream<AbstractGoods> production) {
    // Positive production only
    List<AbstractGoods> pro = transform(production, AbstractGoods::isPositive);
    String tag = null;
    switch (pro.size()) {
    case 0:
        panel.add(new JLabel(), "wrap");
        break;
    case 1:
        tag = "span";
        break;
    default:
        tag = "span, split " + pro.size();
        break;
    }
    for (AbstractGoods ag : pro) {
        panel.add(getGoodsButton(ag.getType(), ag.getAmount()), tag);
        tag = null;
    }
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:21,代码来源:TerrainDetailPanel.java

示例12: createNiceMessages

import javax.swing.JPanel; //导入依赖的package包/类
private JComponent createNiceMessages()
{
	JLabel heading = new JLabel("<html><font size=+1>" + title + "</font></html>");

	JTextArea body = new JTextArea(message);
	body.setHighlighter(null);
	body.setEditable(false);
	body.setFocusable(false);
	body.setOpaque(false);
	body.setBorder(null);
	body.setLineWrap(true);
	body.setWrapStyleWord(true);
	body.setFont(heading.getFont());

	final int[] rows = new int[]{heading.getPreferredSize().height, TableLayout.FILL};
	final int[] columns = new int[]{TableLayout.FILL};

	TableLayout layout = new TableLayout(rows, columns, 5, 5);
	JPanel all = new JPanel(layout);
	all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	all.add(heading, new Rectangle(0, 0, 1, 1));
	all.add(body, new Rectangle(0, 1, 1, 1));

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:27,代码来源:ExceptionDialog.java

示例13: setupResultsNavigator

import javax.swing.JPanel; //导入依赖的package包/类
@SuppressWarnings("nls")
private JComponent setupResultsNavigator()
{
	countLabel = new JLabel();
	firstPage = new JButton("<<");
	prevPage = new JButton("<");
	nextPage = new JButton(">");
	lastPage = new JButton(">>");

	firstPage.setEnabled(false);
	prevPage.setEnabled(false);
	nextPage.setEnabled(false);
	lastPage.setEnabled(false);

	firstPage.addActionListener(this);
	prevPage.addActionListener(this);
	nextPage.addActionListener(this);
	lastPage.addActionListener(this);

	final int width1 = firstPage.getPreferredSize().width;
	final int height = firstPage.getPreferredSize().height;
	final int[] rows = {height,};
	final int[] cols = {TableLayout.FILL, width1, width1, width1, width1,};

	JPanel all = new JPanel(new TableLayout(rows, cols));

	all.add(countLabel, new Rectangle(0, 0, 1, 1));
	all.add(firstPage, new Rectangle(1, 0, 1, 1));
	all.add(prevPage, new Rectangle(2, 0, 1, 1));
	all.add(nextPage, new Rectangle(3, 0, 1, 1));
	all.add(lastPage, new Rectangle(4, 0, 1, 1));

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:35,代码来源:KeyResourcesTab.java

示例14: initializeComponents

import javax.swing.JPanel; //导入依赖的package包/类
private void initializeComponents() {
	
	graphPanel = new JPanel() {
		private static final long serialVersionUID = -1105560304467720245L;
		
		@Override 
		public Dimension getPreferredSize() {
			return getGraphSize();
		}
		
		@Override 
		public void paintComponent(Graphics g) {
			super.paintComponent(g);
			paintGraph((Graphics2D) g, graphPanel.getWidth(), graphPanel.getHeight());
		}
	};
	graphPanel.setFocusable(true);
}
 
开发者ID:CalebKussmaul,项目名称:GIFKR,代码行数:19,代码来源:GraphInterpolator.java

示例15: updateContentPane

import javax.swing.JPanel; //导入依赖的package包/类
private void updateContentPane() {
    JPanel infoPanel = new JPanel();
    infoPanel.setBackground(BACKGROUND);

    JLabel label = new JLabel("Currently running module '" + moduleName + "' on world '" + world.getName() + "'");
    label.setForeground(FOREGROUND);
    label.setBorder(new EmptyBorder(25, 25, 25, 25));
    infoPanel.add(label);

    this.setContentPane(infoPanel);
    this.revalidate();
    this.repaint();
    this.setVisible(false);
    this.pack();
    this.setVisible(true);
}
 
开发者ID:Energyxxer,项目名称:Vanilla-Injection,代码行数:17,代码来源:DisplayWindow.java


注:本文中的javax.swing.JPanel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。