forked from SaptarshiSarkar12/Drifty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:SaptarshiSarkar12/Drifty into has…
…nainmakada-99/master
- Loading branch information
Showing
44 changed files
with
1,034 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package gui.preferences; | ||
|
||
public enum Labels implements preferences.Labels { | ||
FOLDERS, MAIN_AUTO_PASTE, JOBS, ALWAYS_AUTO_PASTE | ||
FOLDERS, MAIN_AUTO_PASTE, JOBS, ALWAYS_AUTO_PASTE, MAIN_THEME | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package gui.utils; | ||
|
||
import javafx.geometry.Pos; | ||
import javafx.scene.Node; | ||
import javafx.scene.control.Hyperlink; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.TextField; | ||
import javafx.scene.image.Image; | ||
import javafx.scene.image.ImageView; | ||
import javafx.scene.layout.HBox; | ||
import javafx.scene.paint.LinearGradient; | ||
import javafx.scene.paint.Paint; | ||
import javafx.scene.text.Font; | ||
import main.Drifty_GUI; | ||
|
||
import java.util.Objects; | ||
|
||
import static gui.support.Constants.MONACO_TTF; | ||
|
||
public class UIComponentBuilder { | ||
private static UIComponentBuilder instance; | ||
|
||
public static UIComponentBuilder getInstance() { | ||
if (instance == null) { | ||
instance = new UIComponentBuilder(); | ||
} | ||
return instance; | ||
} | ||
|
||
public Label buildLabel() { | ||
Label label = new Label(""); | ||
label.setFont(new Font(Objects.requireNonNull(MONACO_TTF).toExternalForm(), 20 * .75)); | ||
label.prefWidth(Double.MAX_VALUE); | ||
label.setAlignment(Pos.CENTER); | ||
return label; | ||
} | ||
|
||
public Label buildLabel(String text, Font font, Paint textFill) { | ||
Label label = new Label(text); | ||
label.setAlignment(Pos.TOP_CENTER); | ||
label.setFont(font); | ||
label.setTextFill(textFill); | ||
return label; | ||
} | ||
|
||
public HBox buildHBox(Node node) { | ||
HBox hbox = new HBox(node); | ||
hbox.setAlignment(Pos.CENTER); | ||
return hbox; | ||
} | ||
|
||
public ImageView buildImageView(Image image, double scale) { | ||
ImageView imageView = new ImageView(image); | ||
imageView.setPreserveRatio(true); | ||
imageView.setFitWidth(image.getWidth() * scale); | ||
return imageView; | ||
} | ||
|
||
public TextField buildTextField() { | ||
TextField tf = new TextField(""); | ||
tf.setPrefWidth(Double.MAX_VALUE); | ||
return tf; | ||
} | ||
|
||
public Hyperlink buildHyperlink(String text, Font font, LinearGradient fill, String url) { | ||
Hyperlink link = new Hyperlink(text); | ||
link.setFont(font); | ||
link.setTextFill(fill); | ||
link.setOnAction(e -> Drifty_GUI.INSTANCE.openWebsite(url)); | ||
return link; | ||
} | ||
} |
Oops, something went wrong.