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


Java JPanel.setSize方法代码示例

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


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

示例1: 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

示例2: createPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:CursorOverlappedPanelsTest.java

示例3: TurnAnalyzer

import javax.swing.JPanel; //导入方法依赖的package包/类
@SuppressWarnings("serial")
public TurnAnalyzer(JFrame frame) {
	super(frame,"Turn analysis");
	menuPainter = new JPanel() {
		public void paint(Graphics g) {
			if (refImg == null) {
				return;
			}
			Graphics2D g2 = (Graphics2D) g;
			g2.scale(2, 2);

			g2.drawImage(refImg, 0, 0, null);
		}
	};
	menuPainter.setPreferredSize(MENU_SIZE_X2);
	menuPainter.setMinimumSize(MENU_SIZE_X2);
	menuPainter.setSize(MENU_SIZE_X2);
	initialize();
}
 
开发者ID:fatmanspanda,项目名称:ALTTPMenuPractice,代码行数:20,代码来源:TurnAnalyzer.java

示例4: erzeugeAusleihButton

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Erzeugt den Ausleih-Button.
 */
private void erzeugeAusleihButton()
{
    JPanel _buttonPanel = new JPanel();
    _ausleihePanel.add(_buttonPanel, BorderLayout.SOUTH);
    _buttonPanel.setPreferredSize(new Dimension(-1, 110));
    _buttonPanel.setSize(-1, -1);
    _buttonPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    _ausleihButton = new JButton();
    _buttonPanel.add(_ausleihButton);
    _ausleihButton.setText("ausleihen");
    _ausleihButton.setPreferredSize(new Dimension(140, 100));
    _ausleihButton.setSize(-1, -1);
    _ausleihButton.setFont(UIConstants.BUTTON_FONT);
    _ausleihButton.setEnabled(false);
}
 
开发者ID:polemonium,项目名称:SE2Project,代码行数:20,代码来源:AusleiheUI.java

示例5: erzeugeAusleihButton

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Erzeugt den Ausleih-Button.
 */
private void erzeugeAusleihButton()
{
    JPanel _buttonPanel = new JPanel();
    _ausleihePanel.add(_buttonPanel, BorderLayout.SOUTH);
    _buttonPanel.setPreferredSize(new Dimension(-1, 110));
    _buttonPanel.setSize(-1, -1);
    _buttonPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    _vormerkenButton = new JButton();
    _buttonPanel.add(_vormerkenButton);
    _vormerkenButton.setText("vormerken");
    _vormerkenButton.setPreferredSize(new Dimension(140, 100));
    _vormerkenButton.setSize(-1, -1);
    _vormerkenButton.setFont(UIConstants.BUTTON_FONT);
    _vormerkenButton.setEnabled(false);
}
 
开发者ID:polemonium,项目名称:SE2Project,代码行数:20,代码来源:VormerkUI.java

示例6: erzeugeVerleihkartenauflister

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Erzeuge das Tabellen-Panel, in dem die Verleihkarten angezeigt werden.
 */
private void erzeugeVerleihkartenauflister()
{
    JPanel verleihkartenAuflisterPanel = new JPanel();
    _hauptPanel.add(verleihkartenAuflisterPanel, BorderLayout.CENTER);
    verleihkartenAuflisterPanel.setLayout(new BorderLayout());
    verleihkartenAuflisterPanel
        .setPreferredSize(new java.awt.Dimension(-1, -1));
    verleihkartenAuflisterPanel.setSize(-1, -1);
    verleihkartenAuflisterPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    JScrollPane verleihkartenAuflisterScrollPane = new JScrollPane();
    verleihkartenAuflisterPanel.add(verleihkartenAuflisterScrollPane,
            BorderLayout.CENTER);
    verleihkartenAuflisterScrollPane
        .setPreferredSize(new java.awt.Dimension(-1, -1));
    verleihkartenAuflisterScrollPane.setSize(-1, -1);
    verleihkartenAuflisterScrollPane.setBorder(BorderFactory
        .createTitledBorder(null, "Verleihkarten", TitledBorder.LEADING,
                TitledBorder.DEFAULT_POSITION, UIConstants.HEADER_FONT));
    verleihkartenAuflisterScrollPane
        .setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAuflisterScrollPane.getVerticalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAuflisterScrollPane.getHorizontalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);

    _verleihkartenAuflisterTableModel = new VerleihkartenTableModel();
    _verleihkartenAuflisterTable = new JTable();
    verleihkartenAuflisterScrollPane
        .setViewportView(_verleihkartenAuflisterTable);
    _verleihkartenAuflisterTable
        .setModel(_verleihkartenAuflisterTableModel);
    JTableHeader tableHeader = _verleihkartenAuflisterTable
        .getTableHeader();
    tableHeader.setFont(UIConstants.HEADER_FONT);
    tableHeader.setReorderingAllowed(false);
    tableHeader.setResizingAllowed(false);
    _verleihkartenAuflisterTable.setFont(UIConstants.TEXT_FONT);
}
 
开发者ID:polemonium,项目名称:SE2Project,代码行数:43,代码来源:RueckgabeUI.java

示例7: erzeugeRuecknahmeButton

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Erzeuge den Rücknahme-Button.
 */
private void erzeugeRuecknahmeButton()
{
    JPanel buttonPanel = new JPanel();
    _ruecknahmePanel.add(buttonPanel, BorderLayout.SOUTH);
    buttonPanel.setPreferredSize(new java.awt.Dimension(-1, 110));
    buttonPanel.setSize(-1, -1);
    buttonPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    _ruecknahmeButton = new JButton();
    buttonPanel.add(_ruecknahmeButton);
    _ruecknahmeButton.setText("zurücknehmen");
    _ruecknahmeButton.setPreferredSize(new java.awt.Dimension(140, 100));
    _ruecknahmeButton.setSize(-1, -1);
    _ruecknahmeButton.setEnabled(false);
    _ruecknahmeButton.setFont(UIConstants.BUTTON_FONT);
}
 
开发者ID:polemonium,项目名称:SE2Project,代码行数:20,代码来源:RueckgabeUI.java

示例8: createIDEEditorPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Constructs an IDE editor panel, whose code is set with a parameter, with which the user can edit the file's code
 * @param initialCode the code that the the file is set to and shows up initially on the editor pane
 * @param d the dimension of the editor panel
 * @return the IDE editor panel
 * @throws IOException if file fails to save, rendering the initial compilation a failure
 * @throws MalformedURLException if the class fails to load into the ArJClassEditor (leaving it unable to run the compiled class)
 */
public JPanel createIDEEditorPanel(String initialCode, Dimension d) throws MalformedURLException, IOException
{
	JScrollPane editorScrollPane = createEditorScrollPane(initialCode);
	editorScrollPane.setPreferredSize(new Dimension((int) d.getWidth(), (int) (2/3 * d.getHeight())));
	consolePane.getViewport().setPreferredSize(new Dimension((int) d.getWidth(), (int) (1/3 * d.getHeight())));
	JPanel editorPanel = new JPanel();
	editorPanel.setLayout(new BoxLayout(editorPanel, BoxLayout.PAGE_AXIS));
	editorPanel.setSize(d);
	editorPanel.add(editorScrollPane);
	editorPanel.add(consolePane);
	compile();
	return editorPanel;
}
 
开发者ID:arjunvnair,项目名称:ArJ-class-editor,代码行数:22,代码来源:ArJClassEditor.java

示例9: MigFrame

import javax.swing.JPanel; //导入方法依赖的package包/类
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);
}
 
开发者ID:lursel,项目名称:ABM-adaptive-tolerance,代码行数:29,代码来源:MigFrame.java

示例10: Controls

import javax.swing.JPanel; //导入方法依赖的package包/类
public Controls() {
	setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
	setBorder(new EmptyBorder(1, 1, 1, 1));
	setBackground(Color.blue);

	JPanel t = new JPanel();
	t.setBorder(new EmptyBorder(5, 5, 5, 5));
	label = new JLabel();
	label.setLayout(new BorderLayout());
	t.add(label);
	t.setSize(1185, 50);
	add(t);
	JPanel p = new JPanel();
	start = new JButton("Start");
	start.addActionListener(this);
	p.add(start);
	processVoting = new JButton("ProcessVoting");
	processVoting.addActionListener(this);
	p.add(processVoting);
	add(p);

	textArea = new JPanel();
	screen = new JTextArea(17, 100);
	screen.setLineWrap(true);
	screen.setForeground(Color.blue);// set color for font
	screen.setBackground(Color.WHITE);// set background color
	// screen.setText("\n" + "Results from encryption and decryption");
	JScrollPane scrollingArea = new JScrollPane(screen);
	scrollingArea.setSize(15, 100);
	textArea.add(scrollingArea, BorderLayout.CENTER);
	add(textArea);

}
 
开发者ID:peterstefanov,项目名称:paillier,代码行数:34,代码来源:GUI.java

示例11: ThemeReaderCrashTest

import javax.swing.JPanel; //导入方法依赖的package包/类
ThemeReaderCrashTest() {
    JPanel panel = new JPanel();
    JScrollPane pane =
        new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    panel.setSize(300, 200);

    panel.add(pane);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:ThemeReaderCrashTest.java

示例12: erzeugeAusleihePanel

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Erzeugt das Ausleih-Panel, in dem die Zusammenfassung und der
 * Ausleih-Button angezeigt werden.
 */
private void erzeugeAusleihePanel()
{
    _ausleihePanel = new JPanel();
    BorderLayout ausleiheDetailsPanelLayout = new BorderLayout();
    _hauptPanel.add(_ausleihePanel, BorderLayout.EAST);
    _ausleihePanel.setLayout(ausleiheDetailsPanelLayout);
    _ausleihePanel.setPreferredSize(new Dimension(240, -1));
    _ausleihePanel.setSize(240, -1);
    _ausleihePanel.setBackground(UIConstants.BACKGROUND_COLOR);
    erzeugeAnzeigerPanel();
    erzeugeAusleihButton();
}
 
开发者ID:polemonium,项目名称:SE2Project,代码行数:17,代码来源:VormerkUI.java

示例13: erzeugeHauptPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Erzeugt das Hauptpanel, in dem sich Verleihkartenauflister,
 * Verleihkartenanzeiger und Rücknahme-Button befinden.
 */
private void erzeugeHauptPanel()
{
    _hauptPanel = new JPanel();
    _hauptPanel.setLayout(new BorderLayout());
    _hauptPanel.setPreferredSize(new java.awt.Dimension(-1, -1));
    _hauptPanel.setSize(-1, -1);
    _hauptPanel.setAutoscrolls(true);
    _hauptPanel.setBackground(UIConstants.BACKGROUND_COLOR);
}
 
开发者ID:polemonium,项目名称:SE2Project,代码行数:14,代码来源:RueckgabeUI.java

示例14: erzeugeRuecknahme

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Erzeuge das Rücknahme-Panel, in dem der Verleihkartenanzeiger und der
 * Rüchnahme-Button liegen.
 */
private void erzeugeRuecknahme()
{
    _ruecknahmePanel = new JPanel();
    BorderLayout ausleiheDetailsPanelLayout = new BorderLayout();
    _hauptPanel.add(_ruecknahmePanel, BorderLayout.EAST);
    _ruecknahmePanel.setLayout(ausleiheDetailsPanelLayout);
    _ruecknahmePanel.setPreferredSize(new java.awt.Dimension(240, -1));
    _ruecknahmePanel.setSize(240, -1);
    _ruecknahmePanel.setBackground(UIConstants.BACKGROUND_COLOR);
    erzeugeVerleihkartenAnzeiger();
    erzeugeRuecknahmeButton();
}
 
开发者ID:polemonium,项目名称:SE2Project,代码行数:17,代码来源:RueckgabeUI.java

示例15: createImportFailedPane

import javax.swing.JPanel; //导入方法依赖的package包/类
private JComponent createImportFailedPane( Exception cause ) {
    JLabel infoLabel = new JLabel( NbBundle.getMessage( ProgressTrackingPanel.class, "ProgressTrackingPanel.importFailedMessage" ));
    infoLabel.setHorizontalAlignment(JLabel.CENTER );
    infoLabel.setBackground(Color.red);
    infoLabel.setOpaque(true);
    infoLabel.setBorder( BorderFactory.createLineBorder(Color.red, 3) );
    
    ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
    PrintWriter printWriter = new PrintWriter( arrayOutputStream );
    cause.printStackTrace( printWriter );
    printWriter.flush();
    String stackTraceText = arrayOutputStream.toString();
    
    JTextArea stackTraceTextArea = new JTextArea( stackTraceText );
    stackTraceTextArea.setEditable(false);
    
    JScrollPane scrollPane = new JScrollPane( stackTraceTextArea );        
    
    JButton copyToClipboardButton = new JButton( NbBundle.getMessage( ProgressTrackingPanel.class, "ProgressTrackingPanel.copyToClipboard" ));
    copyToClipboardButton.addActionListener( (a) -> {
        Toolkit defaultToolkit = Toolkit.getDefaultToolkit();
        defaultToolkit.getSystemClipboard().setContents( new StringSelection(stackTraceText), null );
    });
    
    JPanel p1 = new JPanel( new FlowLayout(FlowLayout.TRAILING) );
    p1.add( copyToClipboardButton );
    
    JPanel p2 = new JPanel( new BorderLayout(0, 10) );
    p2.add( infoLabel, BorderLayout.NORTH );
    p2.add( scrollPane, BorderLayout.CENTER );        
    p2.add( p1, BorderLayout.SOUTH );
    p2.setSize( new Dimension(600,400) );
    p2.setMinimumSize( p2.getSize() );
    p2.setPreferredSize( p2.getSize() );
    
    return p2;
}
 
开发者ID:chipKIT32,项目名称:chipKIT-importer,代码行数:38,代码来源:ProgressTrackingPanel.java


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