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


Java Font.DIALOG属性代码示例

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


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

示例1: main

public static void main(String args[]) {

        Font font = new Font(Font.DIALOG, Font.PLAIN, 12);
        String text = "hello world";
        FontRenderContext frc = new FontRenderContext(null, false, false);
        TextLayout tl1 = new TextLayout(text, font, frc);
        TextLayout tl2 = new TextLayout(text, font, frc);
        if (tl1.equals(tl2) ||
            tl2.equals(tl1) ||
            tl1.equals((Object)tl2) ||
            tl2.equals((Object)tl1))
        {
             throw new RuntimeException("Equal TextLayouts");
        }
        if (!tl1.equals(tl1) ||
            !tl1.equals((Object)tl1))
        {
             throw new RuntimeException("Non-Equal TextLayouts");
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:TextLayoutEqualsTest.java

示例2: makeText

private static void makeText(Graphics2D graphics, ImageSize maxSize, Random rand) {
	switchColor(graphics, rand);
	
	String fontName = Font.SANS_SERIF;
	switch (rand.nextInt(4)) {
		case 0: fontName = Font.SANS_SERIF; break;
		case 1: fontName = Font.MONOSPACED; break;
		case 2: fontName = Font.SERIF; break;
		case 3: fontName = Font.DIALOG; break;
	}
	
	int fontStyle = Font.PLAIN;
	switch (rand.nextInt(3)) {
		case 0: fontStyle = Font.PLAIN; break;
		case 1: fontStyle = Font.BOLD; break;
		case 2: fontStyle = Font.ITALIC; break;
	}
	
	int fontSize = rand.nextInt(MAX_FONT_SIZE + 1);
	
	graphics.setFont(new Font(fontName, fontStyle, fontSize));
	
	int textLength = rand.nextInt(MAX_TEXT_LENGTH + 1);
	String str = Stream.generate(() -> rand.nextInt(MAX_CHAR_SIZE))
			.limit(textLength)
			.map(i -> (char)i.intValue())
			.collect(StringBuilder::new, StringBuilder::append, StringBuilder::append).toString();
	
	graphics.drawString(str, rand.nextInt(maxSize.getWidth()), rand.nextInt(maxSize.getHeight()));
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:30,代码来源:ImageCreator.java

示例3: getFont

protected Font getFont(Component c) {
    Font font = getTitleFont();
    if (font != null) {
        return font;
    }
    if (c != null) {
        font = c.getFont();
        if (font != null) {
            return font;
        }
    }
    return new Font(Font.DIALOG, Font.PLAIN, 12);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:TitledBorder.java

示例4: getFont

/**
 * Returns default font of the titled border.
 * @return default font of the titled border
 * @param c the component
 */
protected Font getFont(Component c) {
    Font font = getTitleFont();
    if (font != null) {
        return font;
    }
    if (c != null) {
        font = c.getFont();
        if (font != null) {
            return font;
        }
    }
    return new Font(Font.DIALOG, Font.PLAIN, 12);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:TitledBorder.java

示例5: SelectionBar

public SelectionBar()
{
	super();

	Messenger.register(MT.TIMER_SERVICE_CONNECTION, this);
	Messenger.register(MT.SERIES_CHANGED, this);
	Messenger.register(MT.NEW_CHALLENGE, this);
	Messenger.register(MT.CHALLENGE_DELETED, this);

	setBorder(new BevelBorder(0));

	Font f = new Font(Font.DIALOG, Font.BOLD, 14);

	seriesLabel = new CurrentSeriesLabel();
	seriesLabel.setFont(f.deriveFont(Font.PLAIN));
	challengeSelect  = createCombo("challengeChange");
	eventSelect = createCombo("eventChange");
	
	connectLabel = new JLabel("Not Connected");
	connectLabel.setForeground(Color.RED);
	connectLabel.setFont(f);

	add(createLabel("Series:", f));
	add(seriesLabel);
	add(Box.createHorizontalStrut(40));

	add(createLabel("Event:", f));
	add(eventSelect);
	add(Box.createHorizontalStrut(40));

	add(createLabel("Challenge:", f));
	add(challengeSelect);
	add(Box.createHorizontalStrut(15));
	
	add(createLabel("Timer:", f));
	add(connectLabel);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:37,代码来源:SelectionBar.java

示例6: SelectionBar

public SelectionBar()
{
    super();

    Messenger.register(MT.SERIES_CHANGED, this);

    setLayout(new MigLayout("ins 2, center, gap 4"));
    setBorder(new BevelBorder(0));

    Font f = new Font(Font.DIALOG, Font.BOLD, 14);
    eventSelect = new JComboBox<Event>();
    eventSelect.setActionCommand("eventChange");
    eventSelect.addActionListener(this);

    lock = new JCheckBox("Lock");
    lock.setActionCommand("lockEvent");
    lock.addActionListener(this);

    JLabel dl = new JLabel("Series:");
    dl.setFont(f);
    JLabel el = new JLabel("Event:");
    el.setFont(f);

    add(dl, "");
    add(new CurrentSeriesLabel(), "");
    add(el, "gap left 25");
    add(eventSelect, "");
    add(lock, "");
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:29,代码来源:SelectionBar.java

示例7: EntrantRenderer

public EntrantRenderer()
{
	super();
	background = new Color(240, 240, 240);
	backgroundSelect = new Color(120, 120, 120);
	backgroundError = new Color(255, 120, 120);
	backgroundErrorSelect = new Color(230, 100, 100);
	topLine = null;
	bottomLine = null;

	topFont = new Font(Font.DIALOG, Font.BOLD, 11);
	bottomFont = new Font(Font.DIALOG, Font.PLAIN, 11);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:13,代码来源:DriverTable.java

示例8: getInstalledFontFamilyNames

/**
 * Get a list of installed fonts in the requested {@link Locale}.
 * The list contains the fonts Family Names.
 * If Locale is null, the default locale is used.
 *
 * @param requestedLocale, if null the default locale is used.
 * @return list of installed fonts in the system.
 */
public String[] getInstalledFontFamilyNames(Locale requestedLocale) {
    if (requestedLocale == null) {
        requestedLocale = Locale.getDefault();
    }
    if (allFamilies != null && lastDefaultLocale != null &&
        requestedLocale.equals(lastDefaultLocale)) {
            String[] copyFamilies = new String[allFamilies.length];
            System.arraycopy(allFamilies, 0, copyFamilies,
                             0, allFamilies.length);
            return copyFamilies;
    }

    TreeMap<String,String> familyNames = new TreeMap<String,String>();
    //  these names are always there and aren't localised
    String str;
    str = Font.SERIF;         familyNames.put(str.toLowerCase(), str);
    str = Font.SANS_SERIF;    familyNames.put(str.toLowerCase(), str);
    str = Font.MONOSPACED;    familyNames.put(str.toLowerCase(), str);
    str = Font.DIALOG;        familyNames.put(str.toLowerCase(), str);
    str = Font.DIALOG_INPUT;  familyNames.put(str.toLowerCase(), str);

    /* Platform APIs may be used to get the set of available family
     * names for the current default locale so long as it is the same
     * as the start-up system locale, rather than loading all fonts.
     */
    if (requestedLocale.equals(getSystemStartupLocale()) &&
        getFamilyNamesFromPlatform(familyNames, requestedLocale)) {
        /* Augment platform names with JRE font family names */
        getJREFontFamilyNames(familyNames, requestedLocale);
    } else {
        loadFontFiles();
        Font2D[] physicalfonts = getPhysicalFonts();
        for (int i=0; i < physicalfonts.length; i++) {
            if (!(physicalfonts[i] instanceof NativeFont)) {
                String name =
                    physicalfonts[i].getFamilyName(requestedLocale);
                familyNames.put(name.toLowerCase(requestedLocale), name);
            }
        }
    }

    // Add any native font family names here
    addNativeFontFamilyNames(familyNames, requestedLocale);

    String[] retval =  new String[familyNames.size()];
    Object [] keyNames = familyNames.keySet().toArray();
    for (int i=0; i < keyNames.length; i++) {
        retval[i] = (String)familyNames.get(keyNames[i]);
    }
    if (requestedLocale.equals(Locale.getDefault())) {
        lastDefaultLocale = requestedLocale;
        allFamilies = new String[retval.length];
        System.arraycopy(retval, 0, allFamilies, 0, allFamilies.length);
    }
    return retval;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:64,代码来源:SunFontManager.java

示例9: getInstalledFontFamilyNames

/**
 * Get a list of installed fonts in the requested {@link Locale}.
 * The list contains the fonts Family Names.
 * If Locale is null, the default locale is used.
 *
 * @param requestedLocale, if null the default locale is used.
 * @return list of installed fonts in the system.
 */
public String[] getInstalledFontFamilyNames(Locale requestedLocale) {
    if (requestedLocale == null) {
        requestedLocale = Locale.getDefault();
    }
    if (allFamilies != null && lastDefaultLocale != null &&
        requestedLocale.equals(lastDefaultLocale)) {
            String[] copyFamilies = new String[allFamilies.length];
            System.arraycopy(allFamilies, 0, copyFamilies,
                             0, allFamilies.length);
            return copyFamilies;
    }

    TreeMap<String,String> familyNames = new TreeMap<String,String>();
    //  these names are always there and aren't localised
    String str;
    str = Font.SERIF;         familyNames.put(str.toLowerCase(), str);
    str = Font.SANS_SERIF;    familyNames.put(str.toLowerCase(), str);
    str = Font.MONOSPACED;    familyNames.put(str.toLowerCase(), str);
    str = Font.DIALOG;        familyNames.put(str.toLowerCase(), str);
    str = Font.DIALOG_INPUT;  familyNames.put(str.toLowerCase(), str);

    /* Platform APIs may be used to get the set of available family
     * names for the current default locale so long as it is the same
     * as the start-up system locale, rather than loading all fonts.
     */
    if (requestedLocale.equals(getSystemStartupLocale()) &&
        getFamilyNamesFromPlatform(familyNames, requestedLocale)) {
        /* Augment platform names with JRE font family names */
        getJREFontFamilyNames(familyNames, requestedLocale);
    } else {
        loadFontFiles();
        Font2D[] physicalfonts = getPhysicalFonts();
        for (int i=0; i < physicalfonts.length; i++) {
            if (!(physicalfonts[i] instanceof NativeFont)) {
                String name =
                    physicalfonts[i].getFamilyName(requestedLocale);
                familyNames.put(name.toLowerCase(requestedLocale), name);
            }
        }
    }

    // Add any native font family names here
    addNativeFontFamilyNames(familyNames, requestedLocale);

    String[] retval =  new String[familyNames.size()];
    Object [] keyNames = familyNames.keySet().toArray();
    for (int i=0; i < keyNames.length; i++) {
        retval[i] = familyNames.get(keyNames[i]);
    }
    if (requestedLocale.equals(Locale.getDefault())) {
        lastDefaultLocale = requestedLocale;
        allFamilies = new String[retval.length];
        System.arraycopy(retval, 0, allFamilies, 0, allFamilies.length);
    }
    return retval;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:64,代码来源:SunFontManager.java

示例10: main

public static void main(String[] args) {
    System.setProperty("java2d.font.usePlatformFont", "true");
    Font f = new Font(Font.DIALOG,Font.PLAIN,12);
    Toolkit tk = Toolkit.getDefaultToolkit();
    tk.getFontMetrics(f);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:FontCrash.java

示例11: SelectionBar

public SelectionBar()
{
    super(new MigLayout("fill, ins 3", "fill"));

    Messenger.register(MT.SERIES_CHANGED, this);
    Messenger.register(MT.RUNGROUP_CHANGED, this);
    Messenger.register(MT.ENTRANTS_CHANGED, this);
    setBorder(new BevelBorder(0));

    Font f = new Font(Font.DIALOG, Font.BOLD, 14);
    Font fn = f.deriveFont(Font.PLAIN);

    resultsButton = new JButton("Print Current Group Results");
    resultsButton.addActionListener(this);
    resultsButton.setActionCommand("resultsPrint");

    refreshButton = new JButton("Refresh");
    refreshButton.addActionListener(e -> Messenger.sendEvent(MT.RUNGROUP_CHANGED, null));

    seriesLabel = new CurrentSeriesLabel();
    seriesLabel.setFont(fn);
    entrantCountLabel = new JLabel("0");
    entrantCountLabel.setFont(fn);

    courseSelect = createCombo("courseChange");
    groupSelect  = createCombo("groupChange");
    eventSelect = createCombo("eventChange");

    groupSelect.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 1, 2, 3, 4, 5, 6 }));

    add(createLabel("Series:", f), "gapleft 10");
    add(seriesLabel, "gapright 20");

    add(createLabel("Event:", f), "");
    add(eventSelect, "gapright 20");

    add(createLabel("Course:", f));
    add(courseSelect, "gapright 10");

    add(createLabel("RunGroup:", f));
    add(groupSelect, "gapright 10");

    add(createLabel("Count:", f));
    add(entrantCountLabel, "");

    add(new JLabel(""), "growx 100, pushx 100");

    add(refreshButton, "");
    add(resultsButton, "gapright 20");
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:50,代码来源:SelectionBar.java

示例12: XDMTheme

public XDMTheme() {
	fontResource = new FontUIResource(new Font(Font.DIALOG, Font.PLAIN, 12));
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:3,代码来源:XDMTheme.java

示例13: init

private void init() {
	setTitle(getString("CONFIG_TITLE"));
	setIconImage(XDMIconMap.getIcon("APP_ICON").getImage());
	setUndecorated(true);
	setSize(500, 400);
	plainFont = new Font(Font.DIALOG, Font.PLAIN, 12);
	boldFont = new Font(Font.DIALOG, Font.BOLD | Font.ITALIC, 12);

	clickHandler = new ConfigMouseAdapter();
	centerPanel = new JPanel(new BorderLayout());
	centerPanel.setBorder(new LineBorder(Color.BLACK));
	add(centerPanel);
	createLeftPanel();
	createRightPanel();

	cardLayout = new CardLayout();

	cardPanel = new JPanel(cardLayout);
	cardPanel.setBackground(Color.white);

	pane.add(cardPanel);// createGeneralPanel());

	cardPanel.add(createGeneralPanel(), getString("CONFIG_LBL1"));

	cardPanel.add(createConnectionPanel(), getString("CONFIG_LBL2"));

	cardPanel.add(createSaveToPanel(), getString("CONFIG_LBL3"));

	cardPanel.add(createAdvancedPanel(), getString("CONFIG_LBL4"));

	cardPanel.add(createProxyPanel(), getString("CONFIG_LBL5"));

	cardPanel.add(createTypesPanel(), getString("CONFIG_LBL6"));

	cardPanel.add(createCredentialPanel(), getString("CONFIG_LBL7"));

	cardPanel.add(createSchedulerPanel(), getString("CONFIG_LBL8"));

	cardPanel.add(createExceptionsPanel(), getString("CONFIG_LBL9"));

	showPanel(getString("CONFIG_LBL1"));
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:42,代码来源:ConfigDialog.java


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