How to create buttons and other images required for a project - java

Basically I am Java developer and I want to know how can I create buttons and other images required for my Java project.
As per my knowledge we will use photoshop for creating images.
But can anybody tell me exact process and any related videos or links showing how to do this task.

Take a look at Oracle's Swing Tutorial it should get you started in the right direction.
EDIT: As per your comment, you might want to take a look at this tutorial. As far as buttons and images are concerned, you just need to us the plain HTML tags. Also, if you are considering building an N-Tier Web Application you could consider taking a look at a framework such as Spring (tutorial here). Spring should make some things easier.

TRY Synth (Java 1.5 and above) .
This can convert the xml into Gui component. This is used for custom gui.
See this link:
http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/synth.html

Normally Web developers uses the Adobe Photoshop and other Adobe tools for Creating the buttons and other images required for the project and finally they will come up with a Prototype.
Java Developers uses the the files(.js,.jpg...etc) created by the web devlopers and they will write the business logic and DAO implementation.

Related

Java - Styling an application

Okay, i am officially scared to ask this question. I am a PHP developer that is attempting to learn the language of JAVA. My experience limits me to PHP, JavaScript and basic CSS to develop and style my web apps.
I would like to know, and this is embarrassing, What technology is used to "Style" JAVA Applications just like CSS is used to "Style" HTML & PHP applications?
I feel so stupid asking this! Please don't think i am an idiot, i am really good with PHP.
I tried to google the answer but gained more questions than answers.
Web Application using Java:
Frontend is same i.e. HTML/Javascript/CSS
Backend Java (from where data you will get, connect with DB etc etc) similar to role of PHP
Desktop Application:
you can use Java Swing for UI and other API for respective work.
Mobile Application:
use J2ME API for developing application
UI here is developed using JAVA API(only api that are allowed to use under KVM (kilobyte virtual machine)).
For better look and feel there are frameworks for it.
What about JavaFX? As far as I know there are similarities to CSS. However, most of the Java applications are designed to match the system's look-and-feel. That's why tweaking is not as important as to web pages. If you want to start with that, have a look at Swing components. Be aware that JavaFX will be included in Java 8. So JavaFX may be seen as the next gen GUI.
Basically U use JSP/JSF/HTML for front end . There too you can use your CSS skills .. That is CSS can be used for styling ...
Assuming you are doing a desktop application, not internet application - as otherwise PHP and especially HTML/CSS would suffice.
Java Swing is a cross-platform emulation of GUI components. It has so called Look and Feels, one of which is the System L&F, which under Windows tries to look as the Windows GUI. Another is really cross-platform looking: the Nimbus L&F. And there are other Look-and-Feels, even from third parties.
Start with System or Nimbus Look and Feel.
Besides that one might set default colors/fonts for specific type of things. One may query them with SystemColor.activeCaptionText or so. Nice for White on Black.
Inside Swing one uses layouts to do the layouting. Generally not pixel perfect, but with really cross-platform, with consideration for different buttons, menues and such.
Use a GUI editor; I am always advocating the NetBeans IDE, also for its simplicity. Though eclipse is very nice too.
Use separate classes, do not pack all in a GUI class, as that becomes a maintenance mess.
The text components: JLabel, tooltip, and so on, have HTML capabilities: "<html><b>Bold</b><i>Italics</i>".

How can designers work with Google Web toolkit?

Some background, normally when I start a new project, a designer creates the HTML template, images, and css for it, and then passes it on to me. I then write the javascript and PHP code needed to get the site working.
However I'm considering moving to google web toolkit so I can code the site using Java rather than Javascript/PHP. The obstacle however, is how I would import the designer's HTML and CSS into GWT.
From what I've seen there doesn't seem to be any easy way of doing so? Alternatively if I coded everything in GWT first, and he was able to just style everything using CSS to make them look how he needs them to, that would also work. But would he be able to do that using just css alone?
Any ideas?
We are a one-designer two-programmer team and we have been having a great time with plain UiBinders, no GWT Designer involved. Our process has two basic modes:
The designer writes plain HTML and we convert it to UiBinder later, or
We make the basic UiBinder and he finishes it up with the necessary structure and Css.
We choose either mode based on how the chips fall in our design process. It's really natural and works great.
The designer had to learn:
CssResources (e.g. addStyleNames='{resources.css.style}' instead of class='style')
ImageResources (e.g. adding them to ClientBundles with the GPE)
UiBinder syntax (e.g. <g:TextBox> instead of <input>)
It was pretty natural. The correlation to HTML and CSS is extremely high, and he can transfer his html/css skills directly to UiBinder.
I have no experience with GWT designer, but I see it as another tool in the middle of our process. Maybe it's worth it, but it's not so hard to avoid it. I used an early iteration right after it joined the official GWT repository and it was super obnoxious.
Pay attention to the GWT Designer. It's UI creating wizard that supports GWT. GWT Designer has visual tools to generate a code for you.

MDI in SWT on Linux?

I'd like to create an MDI application using SWT.
I've done extensive searches and reach that the Decorations Object is the one responsable for trying supporting behavior. However, I've a Linux box, and the example provided
doesn't work for me.
The output of the example provided by the above link is:
Image
However, on Linux (GTK), I see only labels without control bars or boxes!
You might want to take a look at the Eclipse Rich Client Platform. It's built on SWT and gives you the full flexibility of the Eclipse User Interface (with views and editors) - and lots of other interesting stuff like a smart plug-in and modularization system or a full-fledged online help. Take a look at the RCP Mail Demo - it's a simple demo program that shows you how to create different views and move them around. (I'd offer my tutorial, but it's written in german. You'll find lots of good stuff around the net.) If you're still interested, there's a book named Eclipse Rich Client Platform available by Jeff McAffer - excellent guide.
Use the Novocode Application Framework. It has a Desktop Form for exactly that, and I like it, even if tabs are all the hype now. I already used it with great success!
(source: novocode.com)

Any good tips for a PHP programmer starting a GWT project?

Coming from PHP with some Java Struts 2.0 experience any tips/tricks on learning GWT? I have been looking at some tutorials but just wanted to know if anyone has some great gems to pass along?
As someone that has done PHP, Struts2 and GWT, a good tips from me for someone that is coming from web framework like Struts2.0/PHP would be:
Throw away the old mindset, the mindset that a web framework works in request-response way. That's not how GWT works. GWT is a full ajax framework. Get a good understanding of AJAX and throw away those old mindset to get a good grasps of GWT.
Think in application development and not website development. That would affect the way you build navigation in your application with GWT.
You are not building hyperlinks to navigate between html pages, but you are using an event listener to update a partial content in your application. Get a good understanding of this.
With that in mind, always remember that you are not throwing back full html pages, but just updating a partial content in your application
Get a good understanding of Java anonymous class and inner class because you will use this alot in GWT. This is something that is used rarely if you are building with Struts2.0
The last tips would be to learn how to organize your code. If you can do it from beginning, please do so. Because you can write everything in one class if you want to. A good tip would be to take a look at this video on best practice on GWT.
Nothing beats Google's GWT quickstart (IMO):
http://code.google.com/webtoolkit/gettingstarted.html
I agree with karim79. Also add this to your list: http://examples.roughian.com/
GWT developers still need good HTML and CSS skills. It is sometimes useful to build up chunks of HTML on the client or server side (performance, skinning etc.) and not build every part of your GUI using GWT Widget trees in Java code.
Our framework (GWT Portlets) will help you structure your application. It includes a simple demo application in its own directory that you can copy to start a project.

How can a java library be ported to the web?

How do you take a java library that is for the desktop or an applet and make it so you can use its functions for a web page? I know not all things are meant for the web, but can you call a "regular" java class in an apache/tomcat setup server and it "work"? Do you have to so something to it to get it work with a web page?
I was interested in jgrapht for the web but it looks like all desktop or applet and I don't know that it would be possible to return its graphics to the browser, but maybe its libraries and a generated .png rendered by the browser.
Although there is debate on applets being alive or dead, I am not interested in using one at the moment, as it appears it is dead, albeit with new possible life in the latest update 6u10. I don't know that I want to invest in JavaFX either.
Johnny, the thing is that you have to decide what you mean to do. You could, for example, use JGraphT in server side code; the graph could be visualized in a bunch of different ways, like JGaph or graphviz. Then you would output the visualization in some form that works on the web and put it into your web page. In JGraph, that probably means a print interface that generates SVG or PNG.
Or you could emit the graph structure as JSON with a simple walk of the graph and interpret it on the fly in the browser using Javascript.
It's hard to answer the question generally, because it strongly depends on how you mean to use it.
Yes, it is possible to use a java class or jar file in a web appliaction, but it also depends on what you want to do with it.
For example if the library is for mathematics and you want to return results back to the users on a web based application, this is definitely possible. There are many other examples I can give but they are all the same.
As for displaying charts, I have successfully used JFreeChart in a web application using Apache Wicket (which rocks btw).
So to answer your question, you don't really need to "port" the library, you just need to use it and display it's output to a web page instead of a java desktop GUI.
Of course their might be some libraries that are specifically designed for Java GUI stuff like Swing or AWT. But for the most part there is no difference in using a Java library in a J2EE environment or a J2SE environment.
There isn't a closed-form answer to what you are suggesting: porting a Java Library to a browser's environment and using its functionality.
If you are interested in graphing things, here are a few things you can try:
Open Flash Chart - a scriptable flash app that will produce graphs
Bluff - a Javascript library that produces graphs
processing.js - a port of the excelling 'processing' library to Javascript
As for accessing Java-based functionality in the browser, there are some approaches for that. One is to use a toolset like GWT that complies java into an HTML/Javascript/Java application. Another is to use an AJAX-based technology like Direct Web Remoting. It really depends on what you are trying to accomplish.

Categories