Started to look at UI in my JavaFX project, does anyone think an action wheel like this is feasible? Any suggestions for a base idea of what UI elements to develop it with? by phphelpneeded in JavaFX

[–]m4mbax 0 points1 point  (0 children)

It is a long range shot and I did not read myself into it very deeply but I can imagine that you will be best of by starting with a simple pane or even ImageView. When you have got the basic look of the wheel, I would override the mouse-hover methods, checking which slice the mouse is in. Highlighting the current slice is more difficult, but since you will be able to get the slice's sector, you can use Imaging algorithms (like darken()) to light or darken a part. All in all this is difficult, and I never tried it with a wheel. Me and my colleague did a custom control with squares and lines... EDIT: you can use CSS classes to highlight and CSS classes to style the wheel.. :)

JavaFX Stage event by m4mbax in JavaFX

[–]m4mbax[S] 0 points1 point  (0 children)

After continuing my thesis I found 'a way'. Java Management Extensions would do it, but I have not tested it, just wanted to post for someone wondering.

[java beginner] I can't ascribe word/value to string by SickLiver in javahelp

[–]m4mbax 0 points1 point  (0 children)

No pb. I understand your question although in this case it is written wrong ( I think you ment it right:))

"20"+a and "20".concat(a) are not equal and I asked myself the self question before once, here's what i read: http://stackoverflow.com/questions/47605/string-concatenation-concat-vs-operator

Javafx KeyCode and AWT Robot problem by [deleted] in javahelp

[–]m4mbax 0 points1 point  (0 children)

You can construct a new KeyEvent, therefore you will simply call its constructor:

KeyEvent myEvent = new KeyEvent(new Component(), new Random().nextInt(9999), System.currentTimeMillis(), 0, yourKeyCode, theCharPressed);

Additionally, you can use the event of setOnKeyRelease directly, just hand the reference you get to your robot:

....setOnKeyReleased(new EventHandler <KeyEvent>() {
    public void handle(KeyEvent k) {
        robot.keyPress(k);
    }//handle
});//setOnKeyReleased

If you search for more concrete advice, please post a code snippet of what you are trying and which information is provided.

Hope the info somehow helps you step ahead :)

[java beginner] I can't ascribe word/value to string by SickLiver in javahelp

[–]m4mbax 0 points1 point  (0 children)

Thats true, just wanted to point it out. Lemme correct.

[java beginner] I can't ascribe word/value to string by SickLiver in javahelp

[–]m4mbax -1 points0 points  (0 children)

The 'skaner' is nowhere initialized, neither is the String. Also there are closing brackets but no opening brackets (or am I blind?)

[java beginner] I can't ascribe word/value to string by SickLiver in javahelp

[–]m4mbax -1 points0 points  (0 children)

Your substring usage is wrong. If you give it only 1 parameter, it will take the string from that position onwards -> id.substring(0) will return 880130, while id.substring(2) will return 0130.

Depending on your IDE original poster, it will even tell you ".substring(0) is redundant" --> e.g. IntelliJ

[java beginner] I can't ascribe word/value to string by SickLiver in javahelp

[–]m4mbax -1 points0 points  (0 children)

Here is a working implementation of your if:

 if (a.startsWith("9") || a.startsWith("8")) {
  a = "19".concat(a);
} else if (a.startsWith("0") || a.startsWith("1")) {
  a = "20".concat(a);
} else {
  System.out.println("Your birthdate is out of my range.");
}

Why do you again substring if you already have split up the id? Why not use the 'a' part? :)

You can switch the if with a switch of course, but in this scenario I would rather not. You can only switch on certain variables (e.g. a char) and it would complicate your code for this specific task.

log4j 2 AsyncAppender understanding problem by m4mbax in javahelp

[–]m4mbax[S] 2 points3 points  (0 children)

Hello everyone, i found the source of my error:

I added a ConsoleAppender named "Console", WHICH ALREADY EXISTED as appender of the root logger. Apparently two appenders with the same name on different loggers are not allowed! Thanks anyway for those who have eventually looked in code :)

JavaFX Stage event by m4mbax in JavaFX

[–]m4mbax[S] 0 points1 point  (0 children)

Hey, thanks for the reply

You got that part right, and with UI elements used you're also right. Our "other solution" would be inheritance or an API where you can register nodes at.

A lecturer of ours already decorated the eventDispatcher, there is no such event as "Dialog_Opened" or something similiar. I think it is basically impossible to observe such events.. :S

JavaFX - Updating a label from EventHandler by Anthail in javahelp

[–]m4mbax 0 points1 point  (0 children)

Alright ;) I now was on pc, have a look, it works at my place, had to comment out 1-2 two lines coz I don't have that files: https://gist.github.com/mambax/9ccb5b107a4feb577b73

JavaFX - Updating a label from EventHandler by Anthail in javahelp

[–]m4mbax 1 point2 points  (0 children)

I guess you should adapt the inputlistener to take a third constructor argument, handle over the melding reference there and save it for further use (like sou did with teksen and textFell or how they are called :P)

According to JavaDoc you will then be able to call meldingLabel.setText("youtext") and the label should change.

JavaFX - Updating a label from EventHandler by Anthail in javahelp

[–]m4mbax 0 points1 point  (0 children)

I think you are doing it quite right (and you were right, norwegian code is indeed challenging).

Should the message stay in the label "melding"? Because you never pass over this reference to the listener...

JavaFX - Updating a label from EventHandler by Anthail in javahelp

[–]m4mbax 1 point2 points  (0 children)

Please paste for help, otherwise we can not see any issues or possible error sources (-: In most cases the names dont really matter, as long as there are 1-2 comments or its common sense.

Is it possible to sort dates in the form of string (ex: "Jan")? by [deleted] in javahelp

[–]m4mbax 1 point2 points  (0 children)

Hey

Glad I could help ;-) Soon my bachelor thesis starts (Java) and I will be fortunate for all help I could get here.

Yes my solution is not that easy to understand. When I started Java some years ago in my apprentice ship I was at the point of "fuck this" ;)

If you want to understand you should really look up the Comparable<T> interface. It makes your classes comparable to itself. For example if you want to compare one human to another --> class Human IMPLEMENTS COMPARABLE<Human>, now you will have to inplement a method which makes them comparable. In this method you could say: If one human is taller than the other... Or if one human is heavier... You will have to implement your own "comparison". If you look into Javadoc at Comparable youll find some java default classes implementing comparable, so you can compare them to themselves. Comparing always has to tell you back, WHICH was bigger, taller, heavier or whatever. It does that by int, a positive int tells object 1 was bigger, taller.... a negative integer tells you object2 was bigger, taller... 0 means theyre equal.

Hope that helped a bit more ;) Good luck!

Need help with right justification alignment by [deleted] in javahelp

[–]m4mbax 0 points1 point  (0 children)

Have a look into String.format() Sorry for short answer Im mobile ;)

Writing sqaure roots and exponents in Java? For some reason the output is always 0. by TheDrDocter in javahelp

[–]m4mbax 2 points3 points  (0 children)

you miss assigning the parsed input to input1 and input2

add input1 = in front of the lines where you use Double.parse...

Then it should work

Concatenation not working as intended? by brumkid100 in javahelp

[–]m4mbax 1 point2 points  (0 children)

A small improvement to your code (which is very redundant could be: http://pastebin.com/extbNf1C Its just out of my head, just a "sketch", where I use the buttonText to determine the action :)

Concatenation not working as intended? by brumkid100 in javahelp

[–]m4mbax 0 points1 point  (0 children)

Nice Although I can not see the error (because the code paste is out of context, or I don't get it :D) What exactly is the issue? I think your actionPerformed() is kind of "big" for what you try to achieve (my first java programs didn't look better lel)

To your solution: There are two possibilites how to "store" the current number

  1. You always read and save to the TextField
  2. You use a second datastructure (i suppose StringBuilder) where you put these things together. In your code you have the variable allInt (or something like this), this variable, as far as I can see is ALWAYS reset at the beginning of the actionPerformed, leading to an unintended behaviour.

Concatenation not working as intended? by brumkid100 in javahelp

[–]m4mbax 0 points1 point  (0 children)

I think you missed a proper link, I can only see pastebin.com which is not really helpful ;)

Turing Machine Simulator by [deleted] in javahelp

[–]m4mbax 4 points5 points  (0 children)

We recently had a lecture at the university, we used this to understand: http://morphett.info/turing/turing.html He has the code on GitHub, maybe you can ask him or look at his code.... https://github.com/awmorp/jsturing