Giter Club home page Giter Club logo

lwjgui's Introduction

LWJGUI

An LWJGL3-based JavaFX alternative for making user-interfaces in Java. It can be incorperated into your already existing opengl project, or you can make your projects rendering become managed by LWJGUI.

Why LWJGUI?

JavaFX simply does not have the capability to be incoroperated into custom OpenGL projects. LWJGUI is different in that it does not takeover all of the rendering code for your project. This allows it to easily handle your user-interfaces and still leave rendering up to you!

Current Features

  • CSS! (May be unstable)
  • Label
  • Font
  • Button / SegmentedButton / ToggleButton / ToggleSwitch
  • CheckBox / RadioButton
  • ComboBox
  • Popup / ContextMenu
  • MenuBar / ToolBar
  • SplitPane
  • Pane / StackPane / BorderPane / ScrollPane / TabPane
  • OpenGLPane
  • BlurPane
  • TextArea / CodeArea
  • TextField / PasswordField / SearchField
  • HBox / VBox

Screenshots

Modena PicControlExample SyntaxHighlight PicOpenGL ScrollSplitPane Gears TreeView TextArea IDE

Required Libraries

Setup with gradle/maven/sbt/leiningen

  1. Open https://jitpack.io/
  2. Insert to 'search' field string orange451/LWJGUI screenshot
  3. Press "Look up"
  4. Follow simple steps screenshot

Projects That Use LWJGUI

Similar projects

If you need to contact me. My discord is: NovaStrat#2111 Feel free to send me any suggestions/things you need!

lwjgui's People

Contributors

c0de5mith avatar guerra24 avatar hohserg1 avatar httpdigest avatar orange451 avatar protectedvariable avatar skyaphid avatar tasemo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lwjgui's Issues

TextField consumes up and down arrow key presses

I have a TextField control that is used as a "console", I'd like to traverse command history when user presses up/down arrow/cursor -keys. However, the events are consumed by the TextField control and never reach my event handler.

This works with JavaFX 14, my current implementation (using JavaFX): https://github.com/Peanhua/plortz/blob/master/src/main/java/plortz/ui/javafx/Console.java

For example, the following code will not print anything when user presses up/down arrow keys when the text field is active:

var tf = new TextField();
tf.setOnKeyPressed((event) -> System.out.println("pressed " + event.getKeyName()));

Correct rendering when resizing

Rendering on resize does not behave as I expected.

    private void loop() {
        while (!glfwWindowShouldClose(window) ) {
            render();
            glfwPollEvents();
        }
    }
    glfwSetWindowSizeCallback(window, (handle, width, height) -> render());
    private void render() {
        WindowManager.update();
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        lwjguiWindow.render();
        glfwSwapBuffers(window);
    }

resize-test

Custom widget?

I want to create some custom widgets for my project. Where I can find example to that? Or if example not possible please let me know the method. So basically just like any other gui lib we either have a paint method inside component class like qt and swing or we have something like skin classes like javafx. It would be great if you can tell me which classes to look up for understanding how components are exactly made.

Thanks!

NoSuchMethodError in NanoVG

This may just be a problem with my project setup, but when I try to create a window with the WindowManager class, I get an exception:

Exception in thread "main" java.lang.NoSuchMethodError: org.lwjgl.nanovg.NanoVG.nvgCreateFontMem(JLjava/lang/CharSequence;Ljava/nio/ByteBuffer;I)I

Code:
window = WindowManager.generateWindow(DisplayManager.win); StackPane pane = new StackPane(); window.getScene().setRoot(pane); pane.getChildren().add(new Label("yahoo")); window.show()

Thanks in advance

scrollpane doesn't work with ComboBox boxes

When you have a TextField, ComboBox inside s scrollpane. When you scroll the scrollpane to a point the combo box should be off the screen. The drop down, arrow and the text disappear like it should but the box where the text sit doesn't disappear. It just scrolls outside of the scrollpane area. The combo box is still visible

image

Image

Hello! I develop project with your library LWJGUI and i have questions.
I try set image from resources to button, but i get error "java.io.FileNotFoundException".

image

I try
image
and similar solutions, but the result remains the same...
Help me please or send me documentation.
Thank you

Scrollpane/VBox containing BorderPane's allow only the last item to be interacted with

For BorderPane the public void calculateNodeBounds() calculation sets the lower Y coordinate in such a way that all BorderPane instances in the VBox have the same starting Y coordinate.

This makes it so that in the class Context the method Node calculateHoverRecursive(Node parent, Node root) only ever allows interaction with the last item, because it thinks its bounds cover all the rest.

When switching the VBox items to a different class such as HBox the problem does not occur. Seem's like unintentional behavior of the BorderPane class.

Where are it's docs?

I don't know how i can use it. Please, add documentation about how to use this.

Key press events create new event objects for each node

When multiple scene nodes have registered event handlers for key presses they all receive different event objects from the same physical key pressing event. This makes it impossible to use the "consumed" state of the event to signal when the event has been handled.

For example the following will print different addresses for the events and neither of them show the event as "consumed":

var a = new VBox();
a.setOnKeyPressed((event) -> {
    System.out.println("a=" + event + ", consumed=" + event.isConsumed());
    event.consume();
});
var b = new TextField();
b.setOnKeyPressed((event) -> {
    System.out.println("b=" + event + ", consumed=" + event.isConsumed());
    event.consume();
});
a.getChildren().add(b);

Output after pressing a key once:

a=lwjgui.event.KeyEvent@25d28510, consumed=false
b=lwjgui.event.KeyEvent@10297de3, consumed=false

The expected behavior is that both show same address for the event and one of them (the latter) shows the event as being "consumed".

Issue using trees

When using the tree code from the example it returns the error: Cannot invoke "lwjgui.scene.Node.setPrefSize(double, double)" because "this.graphic" is null

ScrollPane content does not adhere to children/parent model

When using setContent(n) on a ScrollPane you cannot retrieve the n value via getChildren. The n value also has its parent marked as null rather than the ScrollPane (or its canvas).

This breaks scene-graph searches for items by ID/Type.

Triple click in textfield causing exception

A triple click in any textfield will cause a StringIndexOutOfBoundsException.

It can be reproduced in TextAreaExample. Start the example and do three fast left mouse clicks in any text area - the app will crash.

Exception in thread "Thread-0" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
	at java.base/java.lang.String.charAt(String.java:693)
	at lwjgui.scene.control.TextInputControl$TextInputScrollPane.lambda$new$2(TextInputControl.java:1126)
	at lwjgui.event.EventHelper.fireEvent(EventHelper.java:15)
	at lwjgui.scene.Node.onMousePressed(Node.java:1235)
	at lwjgui.scene.Window.lambda$mouseButtonCallback$23(Window.java:1089)
	at lwjgui.scene.Window$1.call(Window.java:883)
	at lwjgui.scene.Window$1.call(Window.java:880)
	at lwjgui.Task.callI(Task.java:61)
	at lwjgui.scene.Window.render(Window.java:315)
	at lwjgui.scene.WindowThread.run(WindowThread.java:66)

This only happens if the text field is empty.

Add image on button

Hi all. Can you tell me how i can add image on button?When i add image on button, image dont stay on center button, and when i turn on image, don't event button.

Gradle setup

Hello! I'm want to use your library - LWJGUI, but I dont found way to added it to my gradle project. However, I can use jitpack and added dependecy by github repo, but I dont know what commit or branch is stable/release.
Can you help me for this?
Thanks in advance!

Add a slider

Firstly I would love to thank you for making this. I find this quite resourceful.
I would like to suggest an additional control to the library. A slider. I'm making a 3D game engine, and I need a slider for changing values such as material roughness and light brightness.

Graphic issues with SplitPane

Hi,

While redoing my GUI with your lib I've stumbled into two graphical issues regarding the usage of SplitPane.

First, when I do the following hierarchy: SplitPane <- ScrollPane <- TreeView. (Read "<-" as "contains")
If I set the scroll pane to fill it's parent width and height (which I belive is the correct thing to do when a component must take the whole space it has in a SplitPane) the content of the tree takes the minimal amount of space it can (which is ok since we didn't set it to fill space) but if I set it to fill the space from it's parent I get the following glitch.

Capture d’écran 2020-04-11 à 18 53 35

And when this happens I can also scoll to the right, making the text disappear even tought the text is smaller than the space inside the divider.

My second issue is when I put a StackPane in the middle of a SplitPane with two divisors, it seems that I can't get it to fill it's space (actually I wanted to put an OpenGL pane but to avoid errors comming from my use of the OpenGLPane I replaced it).
If I set to fill width / height to true I get the following result.

Capture d’écran 2020-04-11 à 19 00 37

Whereas if I just set it's pref size to a big enought number I get what I want

Capture d’écran 2020-04-11 à 19 01 44

The code the reproduce this is available here:
https://github.com/ProtectedVariable/ProtectedEngine/pull/19/files

The first issue mentionned is in HierarchyPane.java
The second one in at EditorLayout.java

(On a side note, is there a way to make the divisors of the splitpane thinner ?)

Hope my description is clear enough, feel free to ping me if more infos are needed :)

borderPane.setRight appears on the left side

Using master-SNAPSHOT

        lwjguiWindow = WindowManager.generateWindow(window);
        lwjguiWindow.setWindowAutoClear(false);

        Label label = new Label();
        label.setText("Right pane");

        StackPane stackPane = new StackPane();
        stackPane.setPrefWidth(100);
        stackPane.setFillToParentHeight(true);
        stackPane.setBackgroundLegacy(Color.WHITE);
        stackPane.getChildren().add(label);

        BorderPane borderPane = new BorderPane();
        borderPane.setRight(stackPane);

        Scene scene = lwjguiWindow.getScene();
        scene.setRoot(borderPane);

Result:
border-pane-test

TextField control receives KeyPress events when not in editing

Not sure if this is intended behavior or not.

When a key is pressed, all the TextField controls receive the KeyPress event regardless of their editing state.

From applications point of view the key press events are relevant to a TextField control only when it is in editing mode. It is trivial to add code to check for isEditing() but it is extra lines of code, and the behavior here is unexpected and different from JavaFX.

I can't import LWJGUI in maven

Hi all,

Yesterday I tried import the library in a maven project but i am getting the message shown below

[ERROR] Failed to execute goal on project wglw: Could not resolve dependencies for project org.example:wglw:jar:1.0-SNAPSHOT: Failure to find com.github.orange451:
LWJGUI:jar:Tag in https://jitpack.io was cached in the local repository, resolution will not be reattempted until the update interval of jitpack.io has elapsed or
updates are forced -> [Help 1]
[ERROR]

POM.xml


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>wglw</artifactId>
    <version>1.0-SNAPSHOT</version>


    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <dependencies>

        <dependency>
            <groupId>com.github.orange451</groupId>
            <artifactId>LWJGUI</artifactId>
            <version>Tag</version>
        </dependency>
    </dependencies>

</project>

I have executed this command from terminal
mvn clean install

The project is empty so i dont know why i can't import the library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.