I'm wondering if it's possible to add some custom screen GUI's to my Bukkit server. So I can display a lot of text on someone's screen. Or do I need to find another option to do this?
Thanks!
The only practical way is to use an Inventory using blocks with name and lore for users to click on as can be seen here
As Cole Nelson mentioned, a custom inventory with lore displayed might work. A good guide for that can be found on the bukkit forums, and although it's a bit outdated it should still provide useful information.
Another possibility would be to utilize title screens; obviously those can't hold a ton of information, but the player is pretty much guaranteed to notice them immediatly.
I recommend using Title Api, as it's a bit tedious to directly work with packets.
Once you added the jar to your project and set the dependency, simply use:
TitleAPI.sendTitle(player,fadeIn,stay,fadeOut,"Title","Subtitle");
to send a title with all corresponding attributes.
Example result:
Related
I'm currently working on a client-server project where the client sends a request to the server and the server runs a database statement based on the information from the client. As there's no static length for the output I add all the data to a ArrayList<String> and send it back to the client.
The data that the client requests has a certain hierarchy so that one could also display it using an XML file (however the output to a GUI is wanted here instead of file creation). There's several ways of displaying I came up with. One would be using a simple text area, however using this, I need to do applying the layout myself and the option of folding where I can expand and collapse certain items is not possible.
Another possibility of course would be using a simple JList, however I read on Stackoverflow that using a JList to display hierarchical things is way easier done using a JTree.
When I decided trying to implement JTree I also found the Genealogy.java file provided by Oracle in their documentation of JTree. As to be seen in the first examples of this documentation there is always a filestructure being displayed and hence also a filestructure kind of representation (using folder- and file-symbols) is shown. In contrast to this Genealogy.java only shows the names of the persons so I tried to adapt the implementation from Genealogy.java to my case however I'm completely clueless of how to do this as I don't even know where these symbols come from and where I could possibly disable them and also don't really get what some of the methods I need to implement do.
As I'm currently really clueless of how to possibly accomplish that I really need some detailed help (only telling me to come up with my own implementation of JTree or TreeNode doesn't really help me at this point). Is there any simpler way or is the need to implement any of the before mentioned interfaces inevitable and if so, how would it be done?
EDIT:
This is how it currently would be displayed (example taken from the Oracle documentation, showing folder- and file-symbols in front of the string):
And this is how I want it to be displayed (also from the documentation, this time only displaying a string as node):
The answer almost certainly will be found via the (icon of the) TreeCellRenderer used for the tree nodes. See the File Browser GUI for tips. It shows how to set the icons in the FileTreeCellRenderer. Admittedly the point here is almost exactly opposite what it was there, but it still comes down to the same thing - the icons.
The section of the tutorial that covers it is How to Use Trees: Customizing a Tree's Display.
Now I know that this question has been asked already, but the solution there didn't help me much
As the title suggests, I am looking for a way to implement an Outlook like calendar into my JavaFX application.
I already tried out fullcalendar, but I didn't manage to start the jQueries, which are needed. I tried a lot of methods, but they either aren't working or I'm too dumb to implement it correctly
I also tried jfxtras agenda, I really like the controls and the look of it, unfortunately I'm a rather inexperienced programmer and therefore I'm not really capable of saving these entries
So, if someone could show me an easy - to - implement calendar or a guide to either fullcalendar or jfxtras agenda, I would be very grateful
Thanks in advance
EDIT:
Here are the links,
1) Fullcalendar How to add JQuery onto JavaFx WebView
2) Similar question: Outlook like calendar control in JavaFX 2.0+
Well, JFXtras has a samples in which you can add appointments to Agenda. You can download it from the jfxtras.org website and play with it.
The source code ain't that complex (all you need to do is implement an add appointment callback, see line 44.), but you will need to code yourself. Agenda only does the displaying of the appointments, it is your responsibility to store and retrieve them from your domain model.
https://github.com/JFXtras/jfxtras-labs-samples/blob/8.0/src/main/java/jfxtras/samples/controls/agenda/AgendaSample1.java
Basically what you need to do is:
implement the localDateTimeRangeCallback and set the appointment collection in that method with data from your domain
implement newAppointmentCallback and store new appointments in your domain
monitor the appointments collection for removals, and remove the corresponding appointments in your domain.
I was working on creating a weather application in Java using Weather Underground and I found that it does have data for some cities.
Initially, I was planning on using GeopIP to get the user's location automatically but since the support for cities is limited I decided to let the user choose the city every time the program starts.
I want the user to be able to choose a city from one that is supported by Weather Underground. The user will enter the name and as he/she enters the name, the possible locations will be displayed in a way similar to the one shown in the picture.
My question is:
How do I implement this search feature ?
My initial guess was to create a Vector containing all the names of the cities and then use brute force to find the match and display in a JPopup or a JWindow containing a JList but I guess there has to be a better method
Rephrase:
What I do not understand is WHAT INFO do I keep in the data structure I must use ? Should I manually create a list of cities that Weather Underground supports or is there another way to do it ?
Take a look at the Trie data structure (also known as digital tree or prefix tree). Autocompletion is one of the most common examples of it's usefulness.
The following article has a nice an very approachable explanation:
Roll your own autocomplete solution using Tries.
if you google autosuggestcombobox you will get some interesting results:
This one is written in JavaFX - I have used and extended it myself already. It is quite useful. What you get "for free" with JavaFX: a context menu with right-mouse click which is auto-generated containing some of the usual "stuff", like cut, copy & paste and even undo! So, I can recommend that solution. To get into JavaFX isn't so hard - and I think it is much easier to learn than Swing - and looks so much cooler! However this implementation has some drawbacks - especially when the layout is not left-aligned, because it is simply a text field on top of a combobox.
OK - but if you want to stick to Swing - you could probably use this one. I haven't used that myself, but the code looks quite straightforward and pretty clean - cleaner than the implementation for JavaFX I must admit (but that had some nice features). So - maybe you try - and extend it? It is built simply on JComboBox.
I have downloaded and installed the "Simple Validation" NetBeans Plug-in, but do not know how to use it, because I cannot find where is it present (in toolbox).
Can anyone kindly help me by telling how where can I find it and what are the steps to apply the validation on my form fields.
I also saw there was a Validation API JAR file and I downloaded and included it in my project. It provided 3 controls (or whatever I should say); "ValidationPanel", "ValidationUtils" and "Problems". I saw an example at a website & followed it. I dragged-and-dropped the "ValidationPanel" and wrote the code as shown in following code
final ValidationGroup group = validationPanel1.getValidationGroup();
group.add(txtUserName, Validators.REQUIRE_NON_EMPTY_STRING,
Validators.NO_WHITESPACE,
Validators.REQUIRE_VALID_INTEGER);
But it seems JAR file contains incomplete files or there may be other problem, because it gives error: cannot find symbol: variable "Validators"
I am sorry I think these are 2 questions, but kindly help me how to solve it.
Thanks in advance
You just want the "ValidationPanel".
It seems to be called "org.netbeans.validation.api.builtin.stringvalidation.StringValidators" now.
final ValidationGroup group = validationPanel1.getValidationGroup();
group.add(txtUserName, StringValidators.REQUIRE_NON_EMPTY_STRING,
StringValidators.NO_WHITESPACE,
StringValidators.REQUIRE_VALID_INTEGER);
What you're doing with those lines is creating a validation group and adding a field with 3 validation rules but you still need a way to show that on screen.
Simple validation API provides 2 built-in UI helpers that I'm aware of, you can either use the org.netbeans.validation.api.ui.swing.ValidationPanel or the org.netbeans.validation.api.ui.swing.SwingValidationGroup.createProblemLabel(), otherwise you'll have to implement your own UI widget with the org.netbeans.validation.api.ui.ValidationUI interface.
ValidationPanel creates a JPanel to hold your input controls plus ok and cancel buttons plus the label to show the error messages.
On the other hand you have the ProblemLabel which is the easiest implementation and for me it works in most common cases, here's a little example:
SwingValidationGroup group = SwingValidationGroup.create();;
group.add(txtUserName, Validators.REQUIRE_NON_EMPTY_STRING,
Validators.NO_WHITESPACE,
Validators.REQUIRE_VALID_INTEGER);
JComponent validationLabel = group.createProblemLabel();
contentPanel.add(validationLabel);
That way you have the validationLabel that you can add to any other container like a JPanel or to the form itself, in this case I have a panel named contentPanel that I attach the problem label to.
Hope this clarifies it a little bit as this is an awesome API with poor documentation.
Did you import the required package?
I have been browsing around your many sites about BIRT and specially for Interactivity or scripting related subjects.
But (it would be sooo nice to live in a flawless world) trying to perform some examples (like this one http://kickjava.com/src/org/eclipse/birt/chart/examples/api/interactivity/InteractivityCharts.java.htm) which is supposed to make interactive charts I get nothing ... well yes I get something : charts (very nice ones by the way ;p) but I have searched for the interactivity aaaaaand it's gone ... may be to the swimming pool or at the laundry but certainely not there ... If you want I can send you the code I used to display the charts or anything you'd like but I really need to make my charts interactives and feel quite helpless and distraught (I'd prefer dazed and confused ...).
The easiest path to interactivity for BIRT-based content is the Interactive Viewer. Have a look at the specs here: http://www.birt-exchange.com/be/products/birt-report-viewers/actuate-interactive-viewer/features/
right after declaring your IDeviceRenderer
you must
idr.setProperty( IDeviceRenderer.UPDATE_NOTIFIER, anyclass that implements IUpdateNotifier );
Then you have plenty of documentations on
http://www.birt-exchange.org/documentation/BIRT_220/ChartJavadoc/chart/api/org/eclipse/birt/chart/device/IUpdateNotifier.html
And forever Google is your friend ^^