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


Java SwingConstants类代码示例

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


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

示例1: createMtPanel

import javax.swing.SwingConstants; //导入依赖的package包/类
/**
 * Creates the {@link JPanel} showing the mission time.
 * 
 * @param maxwidth
 *            the dimension of the longest label
 * @return the JPanel showing the mission time
 */
private JPanel createMtPanel(Dimension maxwidth) {
	Double mtVal = inverse.evaluate(reliabilityFunction, standardMT);

	JLabel pmtLabel = new JLabel("P[MT] =");
	pmtLabel.setMinimumSize(maxwidth);

	JLabel mtLabel = new JLabel("MT:");
	mtLabel.setMinimumSize(maxwidth);

	mtProbability = new JFormattedTextField(mtFieldFormat);
	mtProbability.addActionListener(MeasurePanel.this);
	mtProbability.setPreferredSize(new Dimension(70, 15));
	mtProbability.setHorizontalAlignment(SwingConstants.RIGHT);
	mtProbability.setText(standardMT.toString());

	mt = new JLabel(mtVal.toString());

	return createSubPanel("Mission-Time", pmtLabel, mtProbability, mtLabel, mt);
}
 
开发者ID:felixreimann,项目名称:jreliability,代码行数:27,代码来源:MeasuresPanel.java

示例2: update

import javax.swing.SwingConstants; //导入依赖的package包/类
public void update() {
    rows = datasetGenerator.getGCActivityNum();

    labels = new JLabel[rows][columns];
    for (int r = 0; r < rows; ++r) {
        String gcActivityName = datasetGenerator.getGCActivityName(r);
        JLabel label = GUIUtilities.createJLabelForTable(gcActivityName);
        GUIUtilities.setTableHeader(label);
        labels[r][0] = label;

        for (int c = 1; c < columns; ++c) {
            label = GUIUtilities.createJLabelForTable();
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            labels[r][c] = label;
        }
    }
}
 
开发者ID:vimerzhao,项目名称:gchisto,代码行数:18,代码来源:AllStatsTableSingle.java

示例3: getTableCellRenderer

import javax.swing.SwingConstants; //导入依赖的package包/类
@Override
public TableCellRenderer getTableCellRenderer(Engine engine,
                                              AccessRules rules, Attribute attribute) {
    return new DefaultTableCellRenderer() {
        /**
         *
         */
        private static final long serialVersionUID = -7922052040779840252L;

        {
            setHorizontalAlignment(SwingConstants.RIGHT);
        }

        @Override
        public Component getTableCellRendererComponent(JTable table,
                                                       Object value, boolean isSelected, boolean hasFocus,
                                                       int row, int column) {
            Component component = super.getTableCellRendererComponent(
                    table, value, isSelected, hasFocus, row, column);
            if (value != null)
                ((JLabel) component).setText(format(value));
            return component;
        }
    };
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:26,代码来源:PriceAttributePlugin.java

示例4: LoadDelete

import javax.swing.SwingConstants; //导入依赖的package包/类
/**
 * This SavePanel creates delete and load buttons
 * 
 * @param gui
 */
public LoadDelete(GUI gui){
	
	this.setLayout(new BorderLayout());
	
	filename = new JLabel("test");
	filename.setHorizontalAlignment(SwingConstants.CENTER);
	this.add(filename, BorderLayout.PAGE_START);
	
	JButton delete = new JButton("DELETE");
	delete.addActionListener(new Listeners.Delete(gui));
	this.add(delete, BorderLayout.LINE_END);
	
	JButton loadAll = new JButton("LOAD ALL");
	loadAll.addActionListener(new Listeners.LoadAll(gui));
	this.add(loadAll, BorderLayout.LINE_START);
}
 
开发者ID:KayDeeTee,项目名称:Hollow-Knight-SaveManager,代码行数:22,代码来源:LoadDelete.java

示例5: initComponents

import javax.swing.SwingConstants; //导入依赖的package包/类
protected void initComponents() {        
    if (!oPanel.isPrepared()) {
        initComponent = new JLabel(NbBundle.getMessage(InitPanel.class, "LBL_computing")); // NOI18N
        initComponent.setPreferredSize(new Dimension(850, 450));
        // avoid flicking ?
        Color c = UIManager.getColor("Tree.background"); // NOI18N
        if (c == null) {
            //GTK 1.4.2 will return null for Tree.background
            c = Color.WHITE;
        }
        initComponent.setBackground(c);    // NOI18N               
        initComponent.setHorizontalAlignment(SwingConstants.CENTER);
        initComponent.setOpaque(true);
        
        CardLayout card = new CardLayout();
        setLayout(card);            
        add(initComponent, "init");    // NOI18N
        card.show(this, "init"); // NOI18N        
        Utilities.attachInitJob(this, this);
    } else {
        finished();  
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:InitPanel.java

示例6: createButton

import javax.swing.SwingConstants; //导入依赖的package包/类
/**
 * Helper method used to create a button inside a JPanel
 * @param action action associated to that button
 * @return created component
 */
private JComponent createButton(AbstractAction action) {
	JPanel panel = new JPanel(); // Use gridbag as centers by default
	JButton button = new JButton(action);
	button.setHorizontalTextPosition(SwingConstants.CENTER);
	button.setVerticalTextPosition(SwingConstants.BOTTOM);
	button.setPreferredSize(new Dimension((int) (BUTTONSIZE * 3.5), (BUTTONSIZE * 2)));
	button.addMouseListener(rollover);
	//if (action == buttonAction[4]) {
	//	button.setVisible(false);
	//}
	//if (action == buttonAction[0]) {
	//	button.setEnabled(false);
	//}
	//if(action == buttonAction[2]) button.setEnabled(false);
	//if(action == buttonAction[4]) button.setEnabled(false);
	panel.add(button);
	return panel;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:24,代码来源:JWatMainPanel.java

示例7: testFixedScenarios

import javax.swing.SwingConstants; //导入依赖的package包/类
public static void testFixedScenarios(RandomTestContainer container) throws Exception {
        // Fixed scenario - last undo throwed exc.
        RandomTestContainer.Context gContext = container.context();
        JEditorPane pane = EditorPaneTesting.getEditorPane(container);
        // Insert initial text into doc
//        DocumentTesting.insert(container.context(), 0, "abc\ndef\n\nghi");
        DocumentTesting.insert(gContext, 0, "\n\n\n\n\n");
        DocumentTesting.remove(gContext, 0, DocumentTesting.getDocument(gContext).getLength());

        // Check for an error caused by delete a line-2-begining and insert at line-1-end and two undos
        DocumentTesting.insert(gContext, 0, "a\nb\n\n");
        EditorPaneTesting.setCaretOffset(gContext, 2);
        EditorPaneTesting.performAction(gContext, pane, DefaultEditorKit.deleteNextCharAction);
        EditorPaneTesting.moveOrSelect(gContext, SwingConstants.WEST, false); // Should go to end of first line
        EditorPaneTesting.typeChar(gContext, 'c');
        DocumentTesting.undo(gContext, 1);
        DocumentTesting.undo(gContext, 1); // This throwed ISE for plain text mime type
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ViewHierarchyRandomTesting.java

示例8: getCellRenderer

import javax.swing.SwingConstants; //导入依赖的package包/类
/**
 * The original getCellRenderer method is overwritten, since the table
 * displays in red the values of the selected class
 * @param row the row of the cell
 * @param column the column of the cell
 * @return a the TableCellRenderer for the requested cell (row,column)
 */
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
	dtcr.setHorizontalAlignment(SwingConstants.CENTER);
	Component c;
	if (column < cd.getClosedClassKeys().size()) {
		Vector closedClasses = cd.getClosedClassKeys();
		Object thisClass = closedClasses.get(column);
		int thisPop = cd.getClassPopulation(thisClass).intValue();
		c = dtcr.getTableCellRendererComponent(this, Integer.toString(thisPop), false, false, row, column);
		if (NCPA.isSingleClass()) {
			if (thisClass == NCPA.getReferenceClass()) {
				c.setForeground(Color.RED);
			} else {
				c.setForeground(Color.BLACK);
			}
		} else {
			c.setForeground(Color.RED);
		}
	} else {
		c = dtcr.getTableCellRendererComponent(this, "-", false, false, row, column);
		c.setForeground(Color.BLACK);
	}
	((JLabel) c).setToolTipText(cd.getClassName(cd.getClosedClassKeys().get(column)));
	return dtcr;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:33,代码来源:NumberOfCustomersPanel.java

示例9: getLogo

import javax.swing.SwingConstants; //导入依赖的package包/类
/**
 * @return the logo of the contributor company
 */
public JComponent getLogo() {
	switch (this) {
	case POLIMI:
		JLabel logo = new JLabel(GraphStartScreen.HTML_POLI);
		logo.setHorizontalTextPosition(SwingConstants.TRAILING);
		logo.setVerticalTextPosition(SwingConstants.CENTER);
		logo.setIconTextGap(10);
		logo.setIcon(JMTImageLoader.loadImage("logo", new Dimension(70, 70)));
		return logo;
	case ICL:
		return new JLabel(JMTImageLoader.loadImage("logo_icl", new Dimension(-1,40)));
	default:
		return null;
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:19,代码来源:AboutDialogFactory.java

示例10: init

import javax.swing.SwingConstants; //导入依赖的package包/类
private void init() {
    setBackground(new Color(0, 0, 0, 0));
    setOpaque(false);
    JLabel modelo = new JLabel() {
        @Override
        public String toString() {
            return hero.getToString();
        }
    };
    modelo.setBackground(new Color(0, 0, 0, 0));
    modelo.setHorizontalAlignment(SwingConstants.CENTER);
    modelo.setIcon(Images.ARENA_HEROI);
    add(hero.getPanelHeroi(), AbsolutesConstraints.HEROI_PANEL_IMAGEM, 0);
    add(modelo, AbsolutesConstraints.ZERO, 0);
    add(hero.getPanelAtaque(), AbsolutesConstraints.HEROI_PANEL_ATAQUE, 0);
    add(hero.getPanelEscudo(), AbsolutesConstraints.HEROI_PANEL_SHIELD, 0);
    add(hero.getPanelVida(), AbsolutesConstraints.HEROI_PANEL_VIDA, 0);
    add(hero.getPanelPoder(), AbsolutesConstraints.HEROI_PANEL_PODER, 0);
    add(hero.getPanelArma(), AbsolutesConstraints.HEROI_PANEL_ARMA, 0);
    add(hero.getPanelSegredo(), AbsolutesConstraints.HEROI_PANEL_SEGREDO, 0);
    add(hero.getPanelDanoMagico(), AbsolutesConstraints.HEROI_PANEL_DANO_MAGICO, 0);
}
 
开发者ID:limagiran,项目名称:hearthstone,代码行数:23,代码来源:HeroiView.java

示例11: propertyChange

import javax.swing.SwingConstants; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (NbMavenProject.PROP_PROJECT.equals(evt.getPropertyName())) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                if (panel != null && panel.isVisible()) {
                    panel.add(new JLabel(LBL_loading_Eff(), SwingConstants.CENTER), BorderLayout.CENTER);

                    task.schedule(0);
                } else {
                    firstTimeShown = true;
                }
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:EffectivePomMD.java

示例12: initComponents

import javax.swing.SwingConstants; //导入依赖的package包/类
/**
 * Set up the panel contents and layout
 */
protected void initComponents() {
	table = new ResultsTable(getTableModel(), help);
               table.setRowHeight(CommonConstants.ROW_HEIGHT);
	statusLabel.setForeground(Color.RED);
	statusLabel.setFont(new Font("Arial", Font.BOLD, 14));
	statusLabel.setText("WARNING: parameters have been changed since this solution was computed!");
	statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
	help.addHelp(statusLabel, "This solution is not current with the parameters of the model. Click solve to compute a new solution.");

	JPanel intPanel = new JPanel(new BorderLayout(10, 10));

	JScrollPane jsp = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
	JLabel descrLabel = new JLabel(getDescriptionMessage());
               
	intPanel.add(descrLabel, BorderLayout.NORTH);
	intPanel.add(jsp, BorderLayout.CENTER);

	setLayout(new BorderLayout());
	add(intPanel, BorderLayout.CENTER);
	setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

}
 
开发者ID:max6cn,项目名称:jmt,代码行数:26,代码来源:SolutionPanel.java

示例13: paintBorder

import javax.swing.SwingConstants; //导入依赖的package包/类
/**
 * Draws the component border.
 *
 * @param graphics
 *            the graphics context
 */
void paintBorder(Graphics graphics) {
	Graphics2D g = (Graphics2D) graphics.create();
	g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	g.setColor(Colors.BUTTON_BORDER);

	int radius = RapidLookAndFeel.CORNER_DEFAULT_RADIUS;
	switch (position) {
		case SwingConstants.LEFT:
			g.drawRoundRect(0, 0, button.getWidth() + radius, button.getHeight() - 1, radius, radius);
			break;
		case SwingConstants.CENTER:
			g.drawRect(0, 0, button.getWidth() + radius, button.getHeight() - 1);
			break;
		default:
			g.drawRoundRect(-radius, 0, button.getWidth() + radius - 1, button.getHeight() - 1, radius, radius);
			g.drawLine(0, 0, 0, button.getHeight());
			break;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:27,代码来源:CompositeButtonPainter.java

示例14: installLabels

import javax.swing.SwingConstants; //导入依赖的package包/类
private void installLabels(JScrollPane scrollPane) {
	moreColumnsLabel.setIcon(JMTImageLoader.loadImage("table_rightarrow"));
	moreColumnsLabel.setHorizontalAlignment(SwingConstants.CENTER);
	moreColumnsLabel.setToolTipText(moreColumnsTooltip);
	moreColumnsLabel.setVisible(false);

	moreRowsLabel.setIcon(JMTImageLoader.loadImage("table_downarrow"));
	moreRowsLabel.setHorizontalAlignment(SwingConstants.CENTER);
	moreRowsLabel.setToolTipText(moreRowsTooltip);
	moreRowsLabel.setVisible(false);

	scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, moreColumnsLabel);
	scrollPane.setCorner(ScrollPaneConstants.LOWER_LEFT_CORNER, moreRowsLabel);

	if (displaysScrollLabels) {
		updateScrollLabels();
	}

}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:20,代码来源:ExactTable.java

示例15: InformationFrame

import javax.swing.SwingConstants; //导入依赖的package包/类
public InformationFrame() {
	
	setType(Type.POPUP);
	setResizable(false);
	
	setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
	this.setTitle("Approving question");
	this.setPreferredSize(new Dimension(350, 170));
	this.setAlwaysOnTop(isAlwaysOnTopSupported());
	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	getContentPane().setLayout(new BorderLayout());
	
	final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	
	this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75);
	
	this.setIconImage(Toolkit.getDefaultToolkit().getImage(InformationFrame.class.getResource(LOGOPATH)));
	
	final JPanel panel = new JPanel();
	getContentPane().add(panel, BorderLayout.CENTER);
	panel.setLayout(null);
	
	okBtn = new JButton("OK");
	okBtn.setIcon(new ImageIcon(InformationFrame.class.getResource("/com/coder/hms/icons/info_ok.png")));
	okBtn.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
	okBtn.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
	okBtn.setBounds(119, 102, 132, 35);
	okBtn.addActionListener(getAction());
	panel.add(okBtn);
	
	lblMessage = new JLabel("");
	lblMessage.setHorizontalTextPosition(SwingConstants.CENTER);
	lblMessage.setHorizontalAlignment(SwingConstants.LEFT);
	lblMessage.setBounds(87, 21, 246, 74);
	panel.add(lblMessage);
	
	lblIcon = new JLabel("");
	lblIcon.setIcon(new ImageIcon(InformationFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png")));
	lblIcon.setBounds(6, 36, 69, 70);
	panel.add(lblIcon);
	
	this.pack();
}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:44,代码来源:InformationFrame.java


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