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


Java JLabel.setSize方法代码示例

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


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

示例1: MessagePreferencesPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
public MessagePreferencesPanel() {
    setLayout(null);

    refuseMessages = new JCheckBox("Refuse Messages");
    refuseMessages.setSize(150, 25);
    refuseMessages.setLocation(10, 25);
    refuseMessages.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            updateEnabled();
        }
    });
    add(refuseMessages);

    denyMessageLabel = new JLabel("Refusal Message:");
    denyMessageLabel.setSize(150, 25);
    denyMessageLabel.setLocation(20, 50);
    add(denyMessageLabel);

    denyMessageText = new JTextField(REFUSAL_MESSAGE_DEFAULT);
    denyMessageText.setSize(400, 25);
    denyMessageText.setLocation(25, 75);
    add(denyMessageText);

    setSize(STD_XSIZE, STD_YSIZE);
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:26,代码来源:MessageManager.java

示例2: showSplash

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Method showSplash.
 */
private void showSplash() {
	splash = new JFrame();
	ImageIcon spl =
		new ImageIcon(App.class.getResource("resources/splash.png"));
	JLabel l = new JLabel();
	l.setSize(400, 300);
	l.setIcon(spl);
	splash.getContentPane().add(l);
	splash.setSize(400, 300);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	splash.setLocation(
		(screenSize.width - 400) / 2,
		(screenSize.height - 300) / 2);
	splash.setUndecorated(true);
	splash.setVisible(true);
}
 
开发者ID:ser316asu,项目名称:SER316-Munich,代码行数:20,代码来源:App.java

示例3: createUnitLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Draw the unit's image and occupation indicator in one JLabel object.
 *
 * @param unit The unit to be drawn
 * @return A JLabel object with the unit's image.
 */
private JLabel createUnitLabel(Unit unit) {
    final BufferedImage unitImg = lib.getUnitImage(unit);
    final int width = halfWidth + unitImg.getWidth()/2;
    final int height = unitImg.getHeight();

    BufferedImage img = new BufferedImage(width, height,
                                          BufferedImage.TYPE_INT_ARGB);
    Graphics2D g = img.createGraphics();

    final int unitX = (width - unitImg.getWidth()) / 2;
    g.drawImage(unitImg, unitX, 0, null);

    Player player = getMyPlayer();
    String text = Messages.message(unit.getOccupationLabel(player, false));
    g.drawImage(lib.getOccupationIndicatorChip(g, unit, text), 0, 0, null);

    final JLabel label = new JLabel(new ImageIcon(img));
    label.setSize(width, height);

    g.dispose();
    return label;
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:29,代码来源:MapViewer.java

示例4: Splash

import javax.swing.JLabel; //导入方法依赖的package包/类
public Splash(String splashText) throws InterruptedException, IOException{
		BufferedImage image;
		image = ImageIO.read(this.getClass().getClassLoader().getResourceAsStream("lang/jpn/Jupiter.jpg"));
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		label = new JLabel(new ImageIcon(image));
		label.setSize(408, 48);
		text = new JLabel(splashText);
		text.setSize(200, 30);
		text.setBackground(Color.BLACK);
		text.setForeground(Color.WHITE);
		text.setFont(new Font("MS Pゴシック", Font.PLAIN, 20));
		this.setSize(screenSize.width, 48);
		this.setLocation(0, 0);
		this.getContentPane().setBackground(Color.BLACK);
		this.setLayout(new BorderLayout());
		this.getContentPane().add(label, BorderLayout.CENTER);
		this.getContentPane().add(text, BorderLayout.EAST);
		this.setResizable(false);
		this.setUndecorated(true);
		this.setVisible(true);
		Thread.sleep(2000);
		this.setVisible(false);
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:24,代码来源:Splash.java

示例5: createAndShowGUI

import javax.swing.JLabel; //导入方法依赖的package包/类
private static void createAndShowGUI() {

        try {
            UIManager.setLookAndFeel(new TestLookAndFeel());

            JLabel label = new JLabel("Test Label");
            label.setSize(SIZE, SIZE);
            TitledBorder border = new TitledBorder("ABCDEF");
            label.setBorder(new TitledBorder(border));

            if (useLAF) {
                UIManager.setLookAndFeel(new NimbusLookAndFeel());
            } else {
                UIManager.getDefaults().put("LabelUI", MetalLabelUI.class.getName());
            }

            SwingUtilities.updateComponentTreeUI(label);

            paintToImage(label);

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:TitledBorderLabelUITest.java

示例6: StartUp

import javax.swing.JLabel; //导入方法依赖的package包/类
public StartUp( int which ) {
	try {
		URL url = null;
		switch (which) {
			case MapApp.MERCATOR_MAP:
				url = cl.getResource(startUpPath +"smallmapV3.jpg"); //New version3 images
				break;
			case MapApp.SOUTH_POLAR_MAP:
				url = cl.getResource(startUpPath + "MapAppSouthV3.jpg");
				break;
			case MapApp.NORTH_POLAR_MAP:
				url = cl.getResource(startUpPath + "MapAppNorthV3.jpg");
				break;
			case MapApp.WORLDWIND:
				url = cl.getResource(startUpPath + "VirtualOceanV3.jpg");
				break;
			default:
				url = cl.getResource(startUpPath + "smallmap.jpg");
		}
		image = ImageIO.read(url);
	} catch (Exception ex) {
		System.out.println(ex + " null");
		image=null;
	}
	setLayout(null);
	label = new JLabel("Initializing MapApp...");
	label.setFont( new Font("SansSerif", Font.PLAIN, 12) );
	label.setForeground( Color.black );
//	add( label );
	label.setLocation(10, 50);
	label.setSize( label.getPreferredSize() );
	JButton button = new JButton( "Abort" );
	add( button );
	button.setLocation( 3, 3);
	button.setSize( button.getPreferredSize() );
	button.addActionListener( this );
//	System.out.println( getComponentCount() + " components" );
	setBorder( BorderFactory.createLineBorder(Color.black, 2) );
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:40,代码来源:StartUp.java

示例7: paintComponent

import javax.swing.JLabel; //导入方法依赖的package包/类
@Override
protected void paintComponent(Graphics g) {
	super.paintComponent(g);

	JLabel label = new JLabel("Cluster " + cluster.getHostname());
	label.setSize(200, 20);
	label.setHorizontalAlignment(SwingConstants.CENTER);
	add(label, BorderLayout.NORTH);
	//setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:11,代码来源:ClusterVertex.java

示例8: telinha

import javax.swing.JLabel; //导入方法依赖的package包/类
public void telinha() {	
	janela = new JFrame();
	//janela.addMouseListener(this);
	//janela.setSize(img.getWidth(null), img.getHeight(null));
	JLabel background = new JLabel();
	ImageIcon icone = new ImageIcon(img);
	background.addMouseListener(this);
	background.setSize(img.getWidth(null), img.getHeight(null));
	background.setIcon(icone);
	janela.add(background);
	janela.setVisible(true);
	janela.setFocusable(true);
	janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);	
}
 
开发者ID:mundodehads,项目名称:cc-unespar,代码行数:15,代码来源:Mouse.java

示例9: getJLabelDefault

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Criar JLabel padrão para as animações
 *
 * @return JLabel padrão
 */
private JLabel getJLabelDefault() {
    JLabel retorno = new JLabel("", SwingConstants.CENTER) {
        @Override
        public String toString() {
            return card.getToString();
        }
    };
    retorno.setSize(SIZE);
    retorno.setPreferredSize(SIZE);
    retorno.setVisible(false);
    return retorno;
}
 
开发者ID:limagiran,项目名称:hearthstone,代码行数:18,代码来源:Animacao.java

示例10: getJLabelDefault

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Criar JLabel padrão para as animações
 *
 * @return JLabel padrão
 */
private JLabel getJLabelDefault() {
    JLabel retorno = new JLabel("", SwingConstants.CENTER) {
        @Override
        public String toString() {
            return heroi.getToString();
        }
    };
    retorno.setSize(SIZE);
    retorno.setPreferredSize(SIZE);
    retorno.setVisible(false);
    return retorno;
}
 
开发者ID:limagiran,项目名称:hearthstone,代码行数:18,代码来源:Animacao.java

示例11: showPopUp

import javax.swing.JLabel; //导入方法依赖的package包/类
public void showPopUp(List<Card> segredos){
    jPanelSegredos.removeAll();
    for(Card c : segredos){
        JLabel label = new JLabel(c.getImagemSmall());
        label.setPreferredSize(new Dimension(123, 190));
        label.setSize(new Dimension(123, 190));
        jPanelSegredos.add(label);
    }
    setVisible(true);
}
 
开发者ID:limagiran,项目名称:hearthstone,代码行数:11,代码来源:PopUpSegredos.java

示例12: createHandle

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 
 */
protected JComponent createHandle() {
  JLabel label = new JLabel(ROTATE_ICON);
  label.setSize(ROTATE_ICON.getIconWidth(), ROTATE_ICON.getIconHeight());
  label.setOpaque(false);

  return label;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:11,代码来源:mxRotationHandler.java

示例13: createLassoPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
protected JPanel createLassoPanel() {
		JPanel p2 = new JPanel(new BorderLayout());
		JToggleButton tb = new JToggleButton(Icons.getIcon(Icons.LASSO, false));
		tb.setSelectedIcon(Icons.getIcon(Icons.LASSO, true));
		tb.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
//				((AbstractButton)e.getSource()).setSelected(true);
				if (((AbstractButton)e.getSource()).isSelected()) {
					map.setBaseCursor(Cursors.getCursor(Cursors.LASSO));
				} else
					map.setBaseCursor(Cursor.getDefaultCursor());
			}
		});
		tb.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 0));
		p2.add(tb, BorderLayout.WEST);
		p2.setBorder(null);
		JLabel l = new JLabel("<html>Lasso<br>Data</html>");
		l.setSize(35, 60);
		l.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
		p2.add(l);

//		***** GMA 1.6.2: Listen for lasso button to ensure that it works correctly with the 
//		zoom buttons in the main toolbar
		lassoTB = tb;
		lassoTB.addMouseListener(this);

		return p2;
	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:29,代码来源:CustomDB.java

示例14: CornerMapControls

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * The basic constructor.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public CornerMapControls(final FreeColClient freeColClient) {
    super(freeColClient, true);

    compassRose = new JLabel(new ImageIcon(ResourceManager.getImage("image.skin.compass")));
    compassRose.setFocusable(false);
    compassRose.setSize(compassRose.getPreferredSize());
    compassRose.addMouseListener(new MouseAdapter() {

            /**
             * {@inheritDoc}
             */
            @Override
            public void mouseClicked(MouseEvent e) {
                Unit unit = getGUI().getActiveUnit();
                if (unit == null) return;
                int x = e.getX() - compassRose.getWidth()/2;
                int y = e.getY() - compassRose.getHeight()/2;
                double theta = Math.atan2(y, x) + Math.PI/2 + Math.PI/8;
                if (theta < 0) {
                    theta += 2*Math.PI;
                }
                igc().moveUnit(unit, Direction.angleToDirection(theta));
            }
        });

    miniMapPanel = new MiniMapPanel();
    miniMapPanel.setFocusable(false);
    
    /**
     * In order to make the setLocation setup work, we need to set
     * the layout to null first, then set the size of the minimap,
     * and then its location.
     */
    miniMapPanel.setLayout(null);
    miniMap.setSize(MAP_WIDTH, MAP_HEIGHT);
    // Add buttons:
    miniMapPanel.add(miniMapToggleBorders);
    miniMapPanel.add(miniMapToggleFogOfWarButton);
    miniMapPanel.add(miniMapZoomInButton);
    miniMapPanel.add(miniMapZoomOutButton);
    miniMapPanel.add(miniMap);

    String miniMapSkinKey = "image.skin.MiniMap";
    if (ResourceManager.hasImageResource(miniMapSkinKey)) {
        miniMapSkin = ResourceManager.getImage(miniMapSkinKey);
        miniMapPanel.setBorder(null);
        miniMapPanel.setSize(miniMapSkin.getWidth(null),
                             miniMapSkin.getHeight(null));
        miniMapPanel.setOpaque(false);
        // FIXME: LATER: The values below should be specified by a
        // skin-configuration-file.
        miniMap.setLocation(38, 75);
        miniMapToggleBorders.setLocation(4,114);
        miniMapToggleFogOfWarButton.setLocation(4, 144);
        miniMapZoomInButton.setLocation(4, 174);
        miniMapZoomOutButton.setLocation(264, 174);
    } else {
        miniMapSkin = null;
        int width = miniMapZoomOutButton.getWidth()
            + miniMapZoomInButton.getWidth() + 4 * GAP;
        miniMapPanel.setOpaque(true);
        miniMap.setBorder(new BevelBorder(BevelBorder.RAISED));
        miniMap.setLocation(width/2, GAP);
        miniMapZoomInButton.setLocation(GAP, 
            MAP_HEIGHT + GAP - miniMapZoomInButton.getHeight());
        miniMapZoomOutButton.setLocation(
            miniMapZoomInButton.getWidth() + MAP_WIDTH + 3 * GAP,
            MAP_HEIGHT + GAP - miniMapZoomOutButton.getHeight());
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:76,代码来源:CornerMapControls.java

示例15: ColorCustomizationTest

import javax.swing.JLabel; //导入方法依赖的package包/类
ColorCustomizationTest() {
    label = new JLabel();
    label.setSize(200, 100);

    g = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB).getGraphics();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:ColorCustomizationTest.java


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