« first day (2460 days earlier)      last day (2705 days later) » 

01:02
morn
 
3 hours later…
04:00
"All our dreams can come true, if we have the courage to pursue them." -Walt Disney (source)
morning
 
2 hours later…
05:45
@Michael Only odd? walks out
Morning :P
morning
hi everyone
@geisterfurz007 So what about the eventbus? :)
@Julo0sS I am unsure if I understood it correctly. So you would create an Interface or an enum or something and let your controllers subscribe to the EventBus. And whenever you hit a button a value is sent on the EventBus and that will notify all (subscribed) controllers which then will check (with the value of enum for example) if they are responsible for handling the event?
Actually i tried it this way : i created my "CustomEventBus" singleton way. I get the instance of it in any "subscriber" component. Then, in my components, I define a function that will handle "myEvent". MyEvent can be triggered from anywhere, by anything
I will pastebin
06:03
@Julo0sS good man :P
Then you only have to determine somehow if MyEvent is supposed to activate something somewhere. If you have 10 controllers subscribed, a button click might only trigger something in one controller. Or maybe different actions on one controller
Or am I missing something there`?
@geisterfurz007 it will trigger something for any component listening to "this specific event".
So MyEvent is an Interface?
06:43
@geisterfurz007 you register your "subscribers" in the eventbus. Then when the eventbus gets something it tells the subscribers. paste.ofcode.org/Tj9SifUDZNqMpx6UCAJ6Si Don't just copy/paste, all classes & templates are there. this is a dumb example quickly made... ;) It makes me think about the observer pattern
Ah I see...
So you have to have one type per Event? @Julo0sS
you "fire an event" this way : eventBus.post(whateverObject)
and you handle it this way : handle(WhateverObject whateverObject)
so, if the "subscriber" receives an event with a "WhateverObject", then it does something. If it receives an event with a "SomethingElseObject", it does nothing...
Yeah so 1 Class per Event
I think so, I didn't get further yet
In my example I do post an "object", but you can post anything, an "event", etc...
Yeah hence my idea with the enum. Would need a line with if (myEnumValue != MyEnum.SPECIAL_EVENT) return; each time though. But enables multiple events in one method without multiple subscriptions in each Controller
06:56
here is the "post"
@geisterfurz007 yeah. To me the advantage of this, in my case, is that I can use it in any component, I don't care if they are related or not. I can use this to trigger updates, but also to call "children" from another level "child" without having to notice the "parent" component
Yeah. Good find! I consider using this in the future if I hit a similar problem :)
@Julo0sS Have you done a Help window already? These typical F1-kind of help-windows?
@geisterfurz007 no, I just did a small "about" window, but did it with a webview and a html template...^^
Oh that sounds good already. I might come back to that in a few hours if you don't mind :P
okay, I'll pastebin :P
07:52
Is it possible to access a returned object's methods/variables?
@Pigman168 Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
@Pigman168 why not?
@Pigman168 Yes it is by storing the return value in a variable of the return type of the method
int sum = sumOf(1, 2);
System.out.println(sum); //3
Same with an Object:
String x = gimmeString(); //Hello
System.out.println(x.startsWith("He")); //true
Ah ok so I need to make a new variable for the returned object to be able to use it
Thanks @geisterfurz007
Exactly.
08:05
you dont "need" a new variable, you can also chain methods
aka, b.bla().foo().bar();
bar() is called on the returned value of foo(), foo() is called on the returned value of bla() and bla() is called on "b"
Well, in my case the method returns an "Object" type object which means I also need to cast it
I guess I could create a method that returns recasted objects and then chain it but meh
I think you should consider it not returning an Object, but yes, if you need to use the returned value multiple times, you have to put it in a variable
It's just a storage for any type of object, which now that you mention it isn't very practical
it always pays off to return things as interfaces and take things in as interfaces
Although each instance would probably just contain objects of the same type anyway
08:11
data serialization?
Nah, just learning java :D
Ty for the tip though, I'm hella uncomfortable with interfaces so I'll see if I can change that
08:23
Is there a way of making a variable variable? For example if I want to create a user defined variable.
@Pigman168 A map?
@Pigman168 I dont really understand that
I think you mean classes
For example the user inputs "sometext" and then it creates a String called "sometext"
user is the user of the program or the developer of the program?
because users ussually cannot type in anything except a string
user of the program
08:28
morning
Mornin'
in the user interface of your program (which I assume is the command prompt atm) users can only type in stuff
in some user interfaces, you also have buttons, dropdowns, etc, but they work relatively the same
Correct
if you want to have a certain object based on the input, you will have to parse the string to your object
aka, if you have an enum (EXIT, DO_SOMETHING, DO_NOTHING) and you want to convert your string to that enum, you check if it matches any of the values and choose the one it matches
if it doesnt match, you return a null value
enums have this behavior by default
but you can easily make it for any class using a Map<String, MyClass>
which maps instances of "MyClass" based on some "String"
Yea, problem is that it needs to take any possible input and create something out of that
08:34
it's a common practice to use all UPPERCASE on final variables, isn't it?
not really
only on constants
aka, static final immutable
ah that. forgot to put static
i meant for constants
i'm getting a bit more sensitive on naming
some people dislike the upper snake case as it looks ... dramatic sort of
so in that case, pascal case is highly recommended
but apart from that, Java uses a very strong naming convention
aka, Types PascalCase, packages lowercontinuedcase, everything else camelCase
^that
08:50
Found this on the next page of the code conventions "if (c++ = d++) { }"
Conditons based on assignment possibilities would be interesting actually
that is first of all uncompilable
Right
as an integer cannot be implicitly cast to a boolean
but "if (c++ == d++) {}" would compile
"if ((c++=d++) !=0);" I think not
but i never tried
08:55
Won't
Because you cannot set a value to c++ as it is an assignment
09:23
Can I return an object as its original type? Meaning, cast it back to its class within a getter?
ofcourse
casting works with (Classname) object You can check if that cast is safe with an if statement before: if (object instanceof Classname)
but if you do that on the getter level, then maybe you dont want to use an Object as variable that you "get"
you could do it with generics to have unchecked casts
that is what I do sometimes when I can control which values are stored
public ObjectA getObject() { return ObjectA-cast-to-B }
something like that ^
hi
09:31
The answer on this question essentially has B extend A
https://stackoverflow.com/questions/450807/how-do-i-make-the-method-return-type-generic
09:44
Hmm, tried to implement the generics that they used but it didn't work. Any ideas? pastebin.com/YfBDpNuX
simple casting is done by "(B) a"
the generics casting method should work
i dont know why it doesnt
Does it work for you?
> public ObjectA getObject() { return ObjectA-cast-to-B }
The retrun is ObjectA, but in the method you say cast-to-B
You gotta choose, but I doubt you will get both in there so that it makes sense ;)
Haha yea that's the dilemma
/javadoc Stage
09:56
@geisterfurz007 javafx.stage.Stage: The JavaFX Stage class is the top level JavaFX container. The primary Stage is constructed by the platform. Additional Stage objects may be constructed by the application. @since JavaFX 2.0 (1/21)
"you shouldn't assume that other programmers know precedence as well as you do." — Sun Microsystems (1999)
10:29
@geisterfurz007 Idk if you can do something with that, but the idea is there : paste.ofcode.org/LAAwXmygFiUc9Jse5Wm9sk
@Julo0sS Yup 18-20 are perfect!
Thanks a lot!
np ;)
Is there a way to make an overview of the code? Like a scheme? To understand the connections and operations in the code?
@linuscl Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
@linuscl I think IntelliJ has a tool to create UML diagrams
/wiki Unified Modeling Language
10:35
@linuscl Sure, with your brain
@Julo0sS lol, if it's too much, I can't do it with my brain :D ;D
hehe :p
Just saw that that requires the Ultimate vesion of IntelliJ though
I mean, I'm actually using Linux, I'm a freeware and opensource-lover :D
10:39
Do you use eclipse? @linuscl
@geisterfurz007 just saw this message few minutes ago : IntelliJ supports css files on Ultimate Version... wtf? ^^
lol what?
@linuscl but you still require the ultimate version
then you can see css files in there :O
@Julo0sS I write css in java files
:D
10:41
I know
Thanks for the UML tip, I didn't know that, thank you
Or this one :D
@linuscl No problem :) Hope it will help!
@Wietlol yeah, but I can paste my css files and everything goes fine. Think I got to this message when I tried to edit "file & code templates". Right click on a package, new, edit file templates. Css will not appear in the list...
then, i did just right click on my package, new, "File", typed "myFileName.css", and a small banner appears at top of my file with this message :
*.css files are supported by IntelliJ IDEA Ultimate Edition (check..., do not suggest..., ignore)
why you dont use the ultimate version?
@Wietlol $?
€ 499.00 /1st year € 399.00 /2nd year € 299.00 /3rd yr onwards
11:17
.... mistake :P
/javadoc Node#getBoundsInLocal
@geisterfurz007 Bounds getBoundsInLocal(): no description
AAAARGH WTF
JFX IS TROLLING ME
Each Node has a read-only boundsInLocal variable which specifies the bounding rectangle of the Node in untransformed local coordinates. boundsInLocal includes the Node's shape geometry, including any space required for a non-zero stroke that may fall outside the local position/size variables, and its clip and effect variables.
@ItachiUchiha Hi you, need your knowledge...
SceneBuilder -> GridPane is bound to right side of the AnchorPane and moves right, when I resize with right side.
Application -> GridPane doesn't give a fuck and stays where it is
11:29
no resizable property or something disabled?
nothing
I took everything out that would prevent the movement. GridPane totally ignores
@Julo0sS What do you want to know?
I removed the FXML reference, the lookup on the bounds on it, the complete resizeListener on the stage, the idea of even having it, etc
In the SceneBuilder Preview the GridPane moves, in the Application it does not. And I am out of ideas why that might be
@ItachiUchiha well
I implemented a "ImageButton" that extends the basic jfx Button
I'd like to use it like this : <ImageButton imageUrl="/whatever.png"></imageButton>
how can I achieve this? Actually I cannot do this, I can only use this : <ImageButton><graphic><ImageView><Image url="/...">...</</</</
Yeah
In scene builder..
11:38
? what in scene builder?
Ah I found the issue with mine... for whatever reason the resize is not passed to the childrenPane (or something). In SceneBuilder the standalone Scene works, but the whole construct does not either -.-
@Julo0sS You might want to have a look here: docs.oracle.com/javafx/2/api/javafx/fxml/doc-files/…
@Julo0sS that's FXML, isn't it?
@ItachiUchiha Yes it is
Then the way to go for it is to have an ImageView inside the graphic tag
When you write this : <Label text="My Text"></Label>. The FXML instanciates a Label item, and what is it doing to set the text property? Is it calling the "setText" on the Label instance?
11:48
Yup
You got it write.
there are several other solutions, like css with "-fx-graphic". But in my case, I did implement ImageButton which works pretty fine javafx side, there is certainly a way to make it work the same fxml side...
@geisterfurz007 Either of those..
@ItachiUchiha I have a private String imageUrl defined in my ImageButton class. It does not work when I try to put imageUrl attribute in the ImageButton tag...
@Julo0sS graphic is an ObjectProperty, which means you need to pass an Object to it.
my "setImageUrl" calls "setGraphic" function on the button
I do
11:50
If you add a StringProperty and make the ImageView implementation internal, it could work as well..
That will never work :P
You need an imageUrl property
You are missing an AAAAAAAAAAAAARGH in the catch part...
which would be of StringProperty type
@ItachiUchiha i don't get it
really
my imageUrl is a String, right?
11:59
Yeah, but JavaFX uses XProperty to monitor changes on the FX-Thread
So you want it to be StringProperty
@geisterfurz007 to the rescue..
I can't type much.. on phone..
It is an Observable that is constantly beeing monitored on the FX-Thread, that you can add Listeners to and that you can bind to other Properties
@ItachiUchiha :D
@geisterfurz007 okay, what should I do, StringProperty instead of String, that's all?
You begin with StringProperty :D
I am unsure which you all need, but you should add get, and set (which will return the values of it, that you can get/set by using the according methods on the Property) and <name>Property which will return the Property
Hey guys can you have a look at this question?:
I am stuck for many days

https://stackoverflow.com/questions/45148552/designing-generic-type-inheritance-hierarchy
12:03
I am unsure how exactly the reflection works, but better include all of them :D
Ints can't be nullable?
Integer -> can be null
int -> cannot be null
attribute imageUrl is not allowed here
(in fxml file)
I will read some bits, one minute ^^
and will try some bits as well :D
Dumb idea, couldn't you use the graphic attribute of the Button @Julo0sS ?
Or is there more behind the class than the code you posted above?
@Julo0sS what did you do?
12:12
@ItachiUchiha Destroy everything
Joe
Joe
Hi
@ItachiUchiha <ImageButton imageUrl="icon.png"></ImageButton>
Joe
Joe
did u see what happened to us dollar? it is falling
us dollar going down
@Joe in the code?
Joe
Joe
it will collapse soon
no in reallity
12:13
SHAME! SHAME! SHAME!
Joe
Joe
the dollar is falling
@geisterfurz007 there is more
Alright I hope that I might be done in a bit ^^
@Julo0sS I had to switch on my laptop just to write it out ... zzz
This is what you want. Try this on FXML and see if it works
How would one link these components in other fxml files?
12:24
What do you mean?
I did about the same (except for the controllers) and wanted to know how I can use the new Node in an fxml file
I sure do have to reference it, or not?
And if not, why?
New nodes?
This is a custom control that we just created with a imageUrl property in it.
The extended Button
Yeah
But where does fxml know from what an "ImageButton" is without it beeing referenced somewhere
Or is this set the case that the controller is in the same package/project?
It you create the FXML in the same project or you add a jar which contains the definition of ImageButton, everything in the class-path and the FXML can import the class
Just like a normal import on a class
Ah alright :) Thanks
So that is what you are doing right? Creating these jars?
12:28
I am not doing anything
I am too lazy to create a FXML. Therefore, asked @Julo0sS to check it out ;)
Oh I thought you mentioned something like that once
*as job
I am confused
Anyways, I need to go for a run
Later :)
I think @Julo0sS can take it from here.
Later :)
thanks
i'll try all that
its better, i can use my attribute but not working yet...^^
I fall into your catch clause
12:53
whats the exception?
13:12
Boom! Only took me about 90 minutes to get the resize done for one direction...
13:28
Morning, Java!
morning @Michael
is it morn there :o ?
lol
lucky then, no night
 
2 hours later…
15:10
@Sayros Its always sunny here..
15:25
dat moment when you realize java operator overloading doesnt work properly :(
Java has operator overloading?
no
but there is this compile library
and groovy has similar support
yes goovy has
just should precise Groovy :p
why It doesn't work ?
bah I cant see right now but I thugh you re talking about Groovy
its java
trust me
groovy doesnt understand default methods in interfaces
anyway, im off
I didn't even try OOP with groovy :p
I just used it as script functions
15:57
anyone know how Ant's fileset ordering works?
 
2 hours later…
17:31
Can anyone help here ?
0
Q: Executing some method in class after starting application spring-boot

Haskell FunI have a spring-boot server app. In one of the function I run some scheduled threads: private ScheduledExecutorService pool = Executors.newScheduledThreadPool(10); private threadsNumber = 10; @PostConstruct void startThreads() { for (int i = 1; i <= threadsNumber; ++i)...

@HaskellFun Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
 
1 hour later…
user7627726
18:33
Can anyone help me? I think I might have stumped stackOverflow itself.
user7627726
0
Q: How to close eclipse neon console within a program

TommyIs there any way to close the Eclipse Neon console within a program? It is normally exited by clicking the exit button in the top-left of console, but I am wondering if there is some command I can use, or some other alternative. I know I can terminate the program by using System.exit(0), but I wa...

20:43
I have this error: cannot convert from Map<String,String[]> to Map<String,Object>
Would that be considered an autoboxing error?
21:01
Um... there's no autoboxing involved, they simply aren't compatible types
@Unihedron Technically, String[] does derive from an Object, right?
@DemCodeLines technicality is not very effective; A<B> is not A<C> if B is not C
A<B> will only satisfy two contracts, A<B> or A<D extends [a type that B is]>, such as A<D extends Object>
21:23
Generics are overrated.
 
1 hour later…
22:26
What is another way to accomplish this?
@hawkfalcon Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
void method(int x, String... blah) {
}

void methodBlah(int x, String... blah) {
method(x, "foo", blah);
}
 
1 hour later…
user7627726
23:47
@hawkfalcon ummmm....
user7627726
@hawkfalcon just call method directly instead of calling methodBlah which calls method.

« first day (2460 days earlier)      last day (2705 days later) »