Tkzinc like library in java - java

I need to develop some canvas window with graphical entities.
I want to know is there library similar to Tkzinc in java?
http://www.tkzinc.org/tkzinc/index.php

I've used Eclipse GEF before, but that is built on top of an SWT canvas, not Swing. I'm not sure if that's compatible with what you need.
It allows you to build an object-oriented graphical model which responds to events and can be moved around, etc.
The underlying drawing framework is Draw2D which might be useful on its own if you don't want a full MVC framework for editing a model.

Related

How to implement repsonsive design in Eclipse RAP?

The Eclipse RAP (Remote Application Platform) project provides a way to write web applications using SWT.
Due to single sourcing, the written code can also be used in desktop SWT/RCP applications.
Since it is a framework for web applications I was wondering if it supports responsive design?
If so, a simple example would be great. It does not need to be RCP compatible.
I didn't find a lot on the internet, has there been any efforts towards supporting responsive design?
Due to the fact that RAP shields you from web technology, native CSS and other web-techniques won't work.
To summarize the comments, you will likely have to implement one or more custom layouts that adapt to the available space and show/hide/resize the managed controls accordingly.
You may also want to use custom controls or manipulate existing controls to adapt to the available space. in some places. For example, hide texts on toolbar buttons when space becomes rare.
RAP theming can also be leveraged to a certain extent in order to change the appearance and space of certain controls.
Further reading:
EclipseCon 2014 talk: https://www.eclipsecon.org/na2014/sites/default/files/slides/Responsive%20Applications%20Tutorial%20-%20EclipseCon%202014.pdf
A blog post with code examples about responsive UIs with SWT: http://www.codeaffine.com/2014/02/24/responsive-uis-with-eclipse-and-swt/
RAP Theming: https://eclipse.org/rap/developers-guide/devguide.php?topic=theming.html
Understanding SWT Layouts: https://www.eclipse.org/articles/article.php?file=Article-Understanding-Layouts/index.html (ignore the deprecation warning, the core concepts haven't changed since)
You can make it responsive with the use of Passe-Partout created by Tabris. This works in RAP and should be compatible with RCP.
They have made a custom layout : FluidGridLayout.
It's best you use it through the factory class com.eclipsesource.tabris.passepartout.PassePartout.
Source can be found on github:
https://github.com/eclipsesource/tabris/tree/master/com.eclipsesource.tabris.passepartout
Add this plugin to your dependency or just copy the source in your project.
See the blogpost at eclipsesource for basic info:
https://eclipsesource.com/products/tabris/eclipse-rap-documentation/responsive-design/
The great thing about it, is that you program it all in java.
Only issue that I now experience is with scrolling.
In my case I have a workbench and my editorpart needs a scrolledcomposite, only set to V_SCROLL. I've added two resize listeners to set the new minsize of the scrolledcomposite.
One resize listener on the display when the entire browser resizes.
A second resize listener for the parent when only the editorpart resizes. (fe when a view is resized or the editorpart is maximized)

Mixing Swing and JavaFX in a Java desktop chat application

I know that there are already some question about this, but I can't find my way!
I want to implement a desktop chat application with java which is able to send text,image, video, etc.
Now I am using swing component for my chat conversation window.
I create a JFrame and add JTabbedPane to it inorder to have tab for each new conversation.
for creating each tab I act as follow :
create JPanel (I add this to my JTabbedPane as tab)
newtab = new JPanel();
newtab.setLayout(new BoxLayout(newtab, BoxLayout.PAGE_AXIS));
create JTextPane for display's part of the chat (to have style for conversation like android application such as viber, ....)
I want to be able for following styling:
diffrent alignment
change font, color
insert JComponent (to show other type of messages )
setborder of each message round (I don't want the squre one)
...
context = new StyleContext();
kit = new HTMLEditorKit();
chatPane = new JTextPane();
chatPane.setEditable(false);
chatPane.setContentType("text/html");
chatPane.setEditorKit(kit);
chatPane.setText("");
doc = (HTMLDocument) chatPane.getStyledDocument();
CSS(); // it is for adding ccs style to stylesheet of document
JScrollPane scroll = new JScrollPane(chatPane);
newtab.add(scroll , BorderLayout.CENTER);
My problem is to set perfect stying to my display part, since javax.swing.text.html.CSS provides HTML 3.2 support, so the CSS properties that are supported are limited!
while searching on Internet I find JavaFX, but I don't know is it good to use JavaFX and swing together or even is it possible?!
also which layout manager is better for the JPanel (newtab) to have my JTextPane with scroll.
As its already been said, it is possible to mix Swing and JavaFX especially since Java 8 you can do it both ways:
Embed Swing Components in JavaFX with SwingNode
Embed JavaFX Components in Swing with JFXPanel
Recently we had to make the same decision. We had an application and wanted to migrate to JavaFX to get a more modern design and to make use of all the introduced language features like PropertiesBindings etc., which is nicely supported by JavaFX Components.
So first we tried to embed JavaFX in Swing. All new components were embedded with the help of JFXPanel. It was really easy, but from time to time we had some rendering issues which got more and more annoying. "Unfortunatly" we got used to the new JavaFX API, which is why we deceided redesigning our appliction to make it a JavaFX application with some Swing Parts in it, which was possible, when Java 8 was released, since we didn`t wonna waste time on fixing thoses kind of rendering issues. The redesign was actually some work since some concepts are just different. Benefitting from the new API caused some refactorings, we didnt really wonna do in first place.
But then again mixing Swing and JavaFX got a bit fuzzy, and the look and feel of the application didnt really feel convincing, so then we finally removed all Swing Parts and replaced them by JavaFX Components. So far we don`t regret that step, but it was more work then we expected it to be, eventhough we already used patterns like MVP, where only Views had to be refactored, since presenters were (mostly) free from UI stuff (which was really an interesting process, were we learned a lot about MVP and designing an application).
So in conclusion I just can suggest to create a list of views you have and think of all the components you would need and try to find the corresponding components in JavaFX. Make small examples for the most complex components to see if they fullfill all your usecases. If that is the case and you still have enough time to switch to JavaFX I personally would go for a pure JavaFX approach, because of the experiences I made with mixing JavaFX/Swing, especially since your UI design seems to be in an early state. In the end it is just a question of time you have available for your project and if you are really up to learn about the new concepts and components of JavaFX.
Concerning the JavaFX CSS Support, you find a reference here.
It IS possible to mix JavaFX and Swing. But I have no experience in it. I just did a little FX-UI for a small project which was pretty nice. Especially the CSS-Feature is great.
According to mixing, I just recently found a blog which discouraged mixing both technologies: http://dlemmermann.wordpress.com/2014/07/17/javafx-tip-9-do-not-mix-swing-javafx/
Maybe this gives you a little help.
Recently I was asked same question.
About one month ago I started new project with my team. We use Java 8.0 + JavaFX 2.2.
What problems did I find in JavaFX?
It's new technology, so many issues still not answered. And you must look for it own.
No tray supporting, so you must use java.awt.SystemTray.
Also I found one problem in the design.
For example you want to make beautiful list with cells which contains label which stuck to left side and checkbox about right side. But there is no good way to do it and you have to calculate length of cells and etc..
But JavaFX provide great opportunities for cutomizing GUI. And you can incapsulate your design in jxml file. It's very convient, because it even more separate code from design.
About mixing I think that if platform allows it than you have to use a solution that provided a platform.
And I think that the decision to use JavaFX correct, if only because it is a relatively new technology, developed by Oracle and it probably will soon replace the swing.

Guidelines to implement a minimal shape drawing tool desktop application using Java

We need to implement a Java desktop application that allows us (initially) to create / edit / resize / polygons on (initially) images. Then these polygons would be mapped to objects in our domain model.
So we basically need a toolbar with the options describe above and the possibility for the example to create a polygon on the an image and then scale it, or resize it, just that.
Do you know some library that could facilitate our work?
We've analyzed GEF, Picollo, NetBeans Visual API, Plain Swing or SWT/JFace, but none of them seems to help us to achieve our goal, which is, implement a really basic image editing tool.
I would like to mention that I'm not saying that what I want to do is not possible with the analyzed libraries, of course it can be done, but I'd like to learn from your experiences which is the correct path to take for this problem.
Any suggestion will be welcomed.
You could try to use GEF and the eclipse plataform.
this article could help you.
saluti
You might look at GraphPanel, a simple object drawing program. The control components are arranged in a JPanel, but JToolBar is a more flexible alternative.
Have you looked at imagine.dev.java.net? It is a NetBeans Platform application, which, though unfinished, might provide you with an interesting starting point.

Implementing a simple UI editor in Java

I'm thinking about writing a simple UI designer in Java. I'm just playing with ideas at the moment to see if it is feasible.
It would be good to have something like this as all of our UIs are generated from XML. Just wondering if anyone has tried anything like this before. I know there will be a lot of effort in doing something like this.
Does anyone know of any 3rd party products that already do something like this?
If not then at a simple level, it will have drag and drop support for any component that can be positioned on a panel. Then extra bits will be added. Are there any good samples on the net for this?
Cheers
Dated back to 2005, this has an overview of Java UI Builders:
http://www.fullspan.com/articles/java-gui-builders.html
Here is a page on how to use the Eclipse Visual Editor:
http://www.ibm.com/developerworks/opensource/library/os-ecvisual/
Here is a good page on the different approaches to build UIs in Java:
http://leepoint.net/notes-java/GUI/misc/80gui-generator.html
Which GUI technology are you using? Swing? NetBeans has a very good drag-and-drop Swing GUI editor. For Eclipse there are several plugins.
If you want to see other projects in which a Swing GUI is generated from XML config files, there are different libraries that do this.
Eclipse 4.0 Developer Preview was just released with an xml based toolkit called XWT. It can be styled with CSS and has a GUI builder. This is a developer preview and there will be some changes over the next year as it progresses to release 4.1, but it is useable right now and the community support is really good.

Swing Menu that can be customized by user

Is there any framework or lib out there to create a Java swing menue that can be edited by the user via drag and drop?
Added: Implementing a polished solution myself can take a lot of time. What i would like to see: display the entry while dragging, opening submenus automaticially, showing a line where the item would be placed when releasing the mouse. Actually like the windows startmenu in XP. This would take a lot of time, i am still hoping to find framework or a subclassed Jmenu with these features.
You can implement drag and drop on most (all?) Swing components. See this tutorial to get started.
Update: based on your updated question. have a look at JFrameBuilder (note that its not free).
JFrameBuilder is an easy-to-use visual Java GUI builder.
JFrameBuilder provides the application GUI solution for Java developers. It enables Java developers to create sophisticated Swing GUI applications using drag-and-drop interface without spending a lot of time writing code.
Personally I find it a lot simpler to write pretty UIs in SWT (the toolkit used by Eclipse), it has more access to the underlying OS and provides a richer experience that's closer to what you're after in my opinion. Here's a guide to implementing drag and drop in SWT.

Categories

Resources