Font awesome icons java

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

This library provides a bundled version of the FontAwesome font/icons that can easily be used in your Java/JavaFX-based applications.

cathive/fonts-fontawesome

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

Читайте также:  Html window open name

README.md

Font Awesome gives you scalable vector icons that can instantly be customized — size, color, drop shadow, and anything that can be done with the power of CSS.

This library provides a bundled version of these fonts that can easily be used in your Java/JavaFX-based applications.

Screenshot

A compiled and ready-to-use version of this library can be found in the Sonatype OSS Maven Repository (oss.sonatype.org). To use the library in your Maven based projects just add the following lines to your ‘pom.xml’:

dependency> groupId>com.cathive.fontsgroupId> artifactId>fonts-fontawesomeartifactId> version>$ version> dependency>

You can directly use the FontAwesome icons in your JavaFX application. Use instances of com.cathive.fonts.FontAwesomeIconView — either construct them programatically or embed them into your FXML sources:

xml version="1.0" encoding="UTF-8"?>  This example shows three different buttons (stop, play and pause) whose graphic components (icons) are rendered using the FontAwesome icons. --> import javafx.scene.control.Button?> import javafx.scene.layout.HBox?> import com.cathive.fonts.fontawesome.FontAwesomeIconView?> HBox xmlns:fx="http://javafx.com/fxml"> children> Button text="Stop"> graphic> FontAwesomeIconView icon="ICON_STOP"/> graphic> Button> Button text="Play"> graphic> FontAwesomeIconView icon="ICON_PLAY"/> graphic> Button> Button text="Pause"> graphic> FontAwesomeIconView icon="ICON_PAUSE"/> graphic> Button> children> HBox>

About

This library provides a bundled version of the FontAwesome font/icons that can easily be used in your Java/JavaFX-based applications.

Источник

Java font awesome icon Usage,CSS Class Name,SVG & CSS Content Code

Java font awesome icon css class name is fa-java and CSS Content Code is \f4e4 .

Java font awesome icon is part of brands icons.

Table of Contents

Java font awesome icon usage

We can display Java font awesome icon using 3 different ways depending upon our requirement.

Java font awesome icon CSS class name

To display Java font awesome icon, add predefined class name i.e., fa-java (with prefix fa- ) to the i tag.

And we need to add corresponding font awesome icon style for the Java icon.

Java icon has 1 icon style i.e.,brands. We need to append icon style class fab .

Java font awesome icon CSS Content Code

We can display Java font awesome icon using it’s CSS Content Code \f4e4

Читайте также:  Python requests module documentation

Use the following HTML code

 .fontawesomeicon::before < display: inline-block; text-rendering: auto; -webkit-font-smoothing: antialiased; >.Java::before 

Java font awesome icon SVG

Use the following icon SVG to display Java font awesome icon.

Use the following HTML code

This Java displayed using SVG

Change Java font awesome icon size

To increase Java font awesome icon size, use the fa-lg(33 % increase) , fa-2x , fa-3x , fa-4x , or fa-5x classes along with icon class \f4e4. Increase in icon size will be relative to their parent container.

fa-lg 
fa-2x
fa-3x
fa-4x
fa-5x

fa-lg
fa-2x
fa-3x
fa-4x
fa-5x

Java font awesome icon with Fixed Width

All the font awesome icons does not have same width.

For example Java icon and home icon may not have same height and width.

So to display two icons with fixed width and height we can use fa-fw class.

 Fixed Width Normal 
Fixed Width Normal

Fixed Width Normal
Fixed Width Normal

Java font awesome icon Border

To add border to Java font awesome icon, use fa-border class.

Pull Java font awesome icon To the left

To pull Java icon to the left of the container use fa-pull-left class.

 
. The text after Java Icon will be displayed on the right side of the icon.

Pull Java font awesome icon To the left

To pull Java icon to the right of the container use fa-pull-right class.

 
. The text after Java Icon will be displayed on the left side of the icon.

Animate Java font awesome icon

To animate Java font awesome icon, use fa-spin class.

Animate Java font awesome icon with steps

While animating the font awesome icon,We can rotate Java icon in 8 steps instead of uniform rotation.

We can use fa-pulse icon along with fa-spin class.

Rotate Java font awesome icon

To rotate Java font awesome icon, Use fa-rotate-x class

Where ‘x’ represents degree of rotation.

 
Rnormal

R fa-rotate-90

R fa-rotate-180

R fa-rotate-270

Flip Java font awesome icon

To flip Java font awesome icon horizontally and vertically use fa-flip-horizontal and fa-flip-vertical classes.

 F Normal 
F fa-flip-horizontal
F fa-flip-vertical

Combine Java font awesome icon with other font awesome icons

In font awesome icons,using stacking we can combine multiple icons and display it as one icon.

Читайте также:  Как задать размерность массива python

To do that use the fa-stack class on the parent, the fa-stack-1x for the regularly sized icon, and fa-stack-2x for the larger icon.

And use class fa-inverse for an alternative icon color.

In the below example, I am displaying Java font awesome icon on top of icons like fa-square , fa-circle and fa-ban .

And used fa-inverse in the second example to invert the color of the icon.

 
Java on fa-square
Java on fa-circle
Java on fa-ban

Источник

Font Awesome with Swing

Is it possible to use Font Awesome with swing applications? If possible then how to use its icons with swing components (JButton or JLabel). I’ve used Font Awesome earlier with my Primefaces application.

If you can legally distribute the font with the app., Java can most likely load it and register it in the available fonts. Then it is a matter of adjusting the UIManager or PLAF to actually use that font for buttons, labels or whatever..

2 Answers 2

enter image description here

  • Download the zip package from Font Awesome
  • Uncompress it
  • Copy the fontawesome-webfont.ttf file to your project (in the below example, I used it as an embedded resource)
  • Using the Cheeatsheet, copy and past the icon you want to use into your code
  • Load the font and display.
import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.Font; import java.awt.FontFormatException; import java.awt.GridBagLayout; import java.io.IOException; import java.io.InputStream; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestFontAwsome < public static void main(String[] args) < new TestFontAwsome(); >public TestFontAwsome() < EventQueue.invokeLater(new Runnable() < @Override public void run() < try < UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); >catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) < >try (InputStream is = TestFontAwsome.class.getResourceAsStream("/fontawesome-webfont.ttf")) < Font font = Font.createFont(Font.TRUETYPE_FONT, is); font = font.deriveFont(Font.PLAIN, 24f); JLabel label = new JLabel("?"); label.setFont(font); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridBagLayout()); frame.add(label); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); >catch (IOException | FontFormatException exp) < exp.printStackTrace(); >> >); > > 

You can also use the unicode directly, for example, the symbol in the above example is listed as  which could be used as.

 JLabel label = new JLabel("\uf0c0"); 

Источник

Оцените статью