Developing a JAVA GUI builder

Hi,
I've been a middle tier and back end developer mostly, and i've not much development on swing. By that i mean i did not get much into swing programming other than using netbeans gui designer or jdeveloper for front end user interfaces. I have a general knowledge about swing though, how to create a custom component and stuff like that.
However, i have a personal project for which i'd really like to build a gui designer for myself. I know that i can find my through if i dig hard enough, but that means a lot of time. Yes, i can use one the existing gui builders, but this time i want to add a little bit of experience to my swing programming skills, so that i can develop tools for my own development more easily.
Looking around, i see a lot of gui builders, some being open source, but none of them gives me the impressing of being a good example for me. Some of them (like netbeans gui building code) seems to large to examine, and not many simple examples for this seem to exist.
In general, there appears to be a lack of guidance for this kind of development. Swing development resources are plenty, but what about a little more custimized goals like mine ?
I want to create a simple designer with swing, but certainly this kind of task has it's tricks ? How should i represent components (txtbox, listbox, etc) on the designer ? Do i use swing components directly in the designer ? Or do i create representations of them ? What are the tips and tricks for this kind of task ?
So, what kind of resources can i use for making this task easier for me ? Which books would be helpful ? Or any online resources for getting up to speed for creating a simple gui designer in java?
I hope i could express myself clear enoug, and It'd be really appreciated if anyone could contribute about my next step
Best regards

If you actually do go about creating a visual GUi builder, 90% of your code will revolve around using the java.beans package. So you should start learning that first.
Here is an example of how to build a visual GUI builder using the java.beans package:
https://bean-builder.dev.java.net/guide/tutorial.html
http://java.sun.com/j2se/1.4.2/docs/api/java/beans/package-summary.html

Similar Messages

  • JAVA GUI Builder

    Hi,
    Does anyone know any "good" Java GUI Builder?
    Thank all.
    Dang Nguyen Duc

    There is a combination of tools you may find useful:
    Eclipse as an IDE - free and downloadable from eclipse.org
    Plugin for Eclipse called swt-designer. Free version for non-commercial use; very minimal price (~$200) for commercial use (one seat).
    Caveat: This is built around using SWT, not AWT/Swing.
    JBuilder also has GUI building tools.

  • Any Java GUI Builder, please?

    Hello everybody!
    I have to develop a GUI in Java and I am totally rookie on this (Java & GUI development). What I would like to know is whether there is a kind of GUI Builder for Java with free license. I mean, a program which makes me easier to choose where to put the different menus and buttoms of the GUI.
    I explain you a bit more. The IDE that I have to use is Eclipse. The GUI that I have to implement will be done in Java, but what I have to do is to convert a XML file in the GUI (read, parse?). This way I will be able to modify the XML using the GUI and then save the file again (this way the XML file will have been modified). I am working in a windows environment in spite of the GUI will be able to work in Linux too (thanks to a Java VM).
    Thank you very much for your answers! And remember, I need a free license program.
    Fran.

    Encephalopathic wrote:
    My rec: don't use a GUI builder. At your stage, using one will hinder your ability to learn Swing and will set your Java education back at least 6 months if not more. Learn to code Swing by hand. They're not bad to use once you understand Swing, but even then, most professionals that I know do not use them in professional products (they say that the "ugly code" produced can be hard to maintain), but use them mainly for quick prototyping.Couldn't agree more, and I'm not even close to a professional level. I started out with Matisse in Netbeans. I spent quite some time learning how to use Matisse to build a rather large GUI. I spent even longer wrestling with it to try to get it to place components where I wanted them and at the size I wanted them. Then, after all the time spent on building the GUI, I found that I had to start over again from scratch because the code it had generated was so unnecessarily huge and fragmented that adding in the application's functionality was simply not feasible. Not to mention that after a certain point, Netbeans consumed so much memory to keep track of all the GUI elements that it crippled my PC (~997MB RAM) soon after opening the project.
    So now I have to start over from scratch and have to hand-code it too. I would have been better off just starting by hand-coding in the first place. That way I wouldn't have lost so much time.
    Besides, If you have to build a parser that builds the GUI from the contents of an XML file, I don't think any GUI builder would be of any use to you. Surely you'd have to study swing to a degree where you can hand-code a GUI with ease if you want to have any chance of building a program that can build a GUI on your behalf based on arbitrary XML content.
    I could well be wrong because I'm still very much a beginner myself, but in my experience elsewhere I've always found that if you want to build a parser for something you're going to need to know whatever it is you're building a parser for like the back of your hand.

  • SQL Developer and Java GUI problems

    I am having a problem with all the java apps i use, including Oracle SQL Developer. When i load up SQL developer, the top of the "Connections" text is chopped off as well as all the table names in the list when I make a connection. Also the java buttons are rather large. Almost as if they have a carriage return in the text of the button.
    Its seems the gui configuration for java has been corrupted, but i cannot find where to modify those settings. I cant find anything on the internet on this. I have checked my video card settings and modified them to see if that is the issue, but it doesnt fix the problem.
    Since other java apps do the same thing, I know its a java issue, but Ive uninstalled all the JRE's and JDKs i have and reinstalled them, and I still have the problem.
    Im on an Windows XP box and running the JDK and JRE 1.5.0_09 versions. Any help would be appreciated. its very annoying to not be able to read some of the text in the java apps including sql developer due to the tops being cut off.
    I have an ATI RADEON 7000 on an DELL optiplex gx620.
    any help would be appreciated

    The first thing to try, if you haven't already, is to update your video driver.

  • Lighter Java GUI than awt and swing?

    I had recently came across a company website (http://www.bambookit.com) where they developed a java gui library without using awt and swing (seems to what they claim). And on top of that it uses xml to generate the gui components (they call widgets) and the whole library size is only 95kb and supports java 1.1.x and above. Their demos on the applets loads super fast, never know/experience that java applets can actually be this quick. But this confuses me, how is it possible to develop a gui alternative to awt with the basic java classes and no dependency on awt? But since the applets are awt based, it means that they must have some dependencies.
    This is an extract from their website (that it seemed they did not use awt)
    "Java has a fundamental flaw in its paint thread that made it very difficult to build extremely large applications without getting severe performance and resource penalties (This affects both AWT and Swing based applications). It�s main repaint queue\thread when assigning paint regions to various controls uses the Graphics objects to �clip� them. On a Sun Solaris machine this does not cause any problems, however on a windows machine each Graphics object consumes a system resource/handle, (a limit of around 16,000 exists on Win 95 and Win 98 machines). Each Bitmap image, each font object, each icon consumes a single system resource or handle. If a full repaint is performed on an application containing 1000 controls, it would consume at LEAST 1000 system resource handles. If the application was updated many times a second, lets say 10 times a second, then that equates to 10,000 handles a second. This is not taking into account labels within controls, the various fonts styles and sizes created, the various images that get loaded. This could easily exceed 20,000 system resource requests a second. Bambookit on the other hand utilizes the clip routines and passes along a SINGLE Graphics objects to all its various controls. This alone is a HUGE savings in system resources and performance."
    Two questions came to my mind:
    1) Is it possible to build applet gui without using awt and swing in java? If so the only way to do is to use JNI calls?
    2) Am I wrong in interpreting www.bambookit.com's message that they are not using awt?
    Any comments about this?
    Regards,
    Stanly

    They use AWT as basis for their drawing-layer, as any other lightweight toolkits too.
    If you just want a very fast & light alternative to swing/awt have a look at www.lwvcl.com !
    I use it for a large applet-applikation that has to be java-1.1 compatible. It was a horor when using AWT which was implemented different over all JVMs available and very slow (although native widgets were used).
    With lwvcl (which has only 150kB!) I can use state of the art applets that work very fast on modern jvms like 1.4, give me the ability to compile my applikation to native code using GCJ (using the swt-prt of the library) or distribute it to old-school 1.1 browser where it also runs quite fine...
    Its free for GPL and very cheap for commercial use.
    lg Clemens

  • I would like to develope a GUI-Builder with Java. Any idea

    Hi!
    I would like to support GUI-Developers by writing a GUI-Builder with integrated design rules. For example selecting Platform dependent widgets, controlling the number of widgets on the form, proper positioning of widgets on the form etc.This should be a standalone application.
    Any one with tips, tricks, literature for architecture, tools to use etc?
    Thanks a million times.
    Marc

    Before start i would like you to visit www.netbeans.org
    Here you can find a very powerful IDE for Java as you are willing to create. If you like to procide creating then also you can find idea about that.

  • Java GUI development tools .. JBuilder??

    dear people..i need some help..
    i am building a GUI, which has menu options. It allows users to design a GUI.. but i have to write code that wil add objects and shapes to the GUI, when the user selects an option from the GUI menu.
    however.. i have heard JBuilder or similar tools.. can automatically add my code when the user selects an option from the menu.. is this correct.. ??
    If so,, what other tools can also do this..?? that can be freely downloaded??
    does anyone know of any??
    thank you in advance...

    Forte for Java the ultimate choice !! And its fully developed using Java !
    http://wwws.sun.com/software/Developer-products/

  • JavaFX Visual GUI Builder - not using FXML - only based on pure Java

    The decision to provide a pure Java based JavaFX API activates the pure Java people who where FXML resistent in the past.
    JavaFX is the future ... the last few month when I check the new possibilities I came slowly but surely to this opinion...
    The Scene Build is still based on FXML. So ... for the pure Java developer there is no advantage to use it ... only to see what components are available in the JavaFX standard I see no advantage for me to use it. I won't create JavaFX clients based on FXML.
    What's the future plan...is there a Project in the World who want to provide a Visual GUI Builder who produce pure Java based JavaFX Code like Eclipse Window Builder do it for Swing or SWT or JBuilder for Swing many years ago.
    That's the main reason that JavaFX get successful in the future. A software architect who has to decide using JavaFX as the new Company Standard...will never do it without stomachache.
    Do I miss some news?
    Is there are NetBeans Version who can do it or a plugin I don't now?
    Edited by: 984992 on 30.01.2013 14:24
    Edited by: 984992 on 30.01.2013 14:30

    I don't think you are getting it, or just making a big deal about it.
    Currently SceneBuilder is connected to Netbeans using the FXML. It's not hard at all, nor is there a big issue. In the next few years Scenebuilder will be in Netbeans integrated, so it will be just like the swing gui builder. FX is still new, from a scripting lang, to a super powerful lang. FXML uses so little code.... Also you can do things either with, or without FXML, FXML IS NOT NEEDED IN FX AT ALL, only limited on Scene Builder.
    This is the FXML I am using for a dice game I am creating. Not much at all.
    <?xml version="1.0" encoding="UTF-8"?>
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.collections.*?>
    <?import javafx.scene.chart.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.image.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.paint.*?>
    <BorderPane fx:id="border" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="785.0" prefWidth="1518.0" xmlns:fx="http://javafx.com/fxml" fx:controller="ZonkController">
    <left>
    <AnchorPane minHeight="86.0" minWidth="62.0" prefHeight="390.0" prefWidth="768.0">
    <children>
    <Button fx:id="button" layoutX="126.0" layoutY="90.0" onAction="#handleButtonAction" text="Click Me!" />
    <Pane fx:id="pane" layoutX="737.0" prefHeight="390.0" prefWidth="211.0" />
    </children>
    </AnchorPane>
    </left>
    <right>
    <AnchorPane prefHeight="386.0" prefWidth="460.0">
    <children>
    <BarChart fx:id="barChart" layoutX="7.0" layoutY="-10.0" prefWidth="460.0">
    <xAxis>
    <CategoryAxis fx:id="names" side="BOTTOM" />
    </xAxis>
    <yAxis>
    <NumberAxis fx:id="scores" side="LEFT" />
    </yAxis>
    </BarChart>
    </children>
    </AnchorPane>
    </right>
    <top>
    <ImageView fx:id="iv" fitHeight="394.24998969072755" fitWidth="525.6666641235352" pickOnBounds="true" preserveRatio="true" BorderPane.alignment="TOP_CENTER" />
    </top>
    </BorderPane>
    It is all codecompleted like a class normally would, so there is nothing to worry about :)
    .CSS isn't hard either.

  • Tools for GUI development in Java

    hi,
    Can anybody tell me which r the tools available for GUI development using java?which could be the best

    Take care not to produce much source code! Use a suitable framework rather than a tool and save maintainability. E.g. http://www.must.de/cameleon.html

  • Free Download JFrameBuilder 2.1.5 - Visual Java GUI Development Tool.

    JFrameBuilder is a really easy-to-use visual Java GUI designer. Create GUI applications using a drag-and-drop interface without spending a lot of time writing code.
    Quick and Easy-to-use
    Download it now!
    http://www.mars3000.com/index.html

    Do you like it?

  • Discussion: Why no centralize development for Java (like the one in ABAP)

    I am reading the NetWeaver Development Infrastructure, and noticed that due to the distributed development nature of Java, SAP recommend The Four-System Landscape for the development lifecycle.
    Each developers has their own local development environment, that's why it is necessary to 'reconcile' the environment using one more layer of system. Although they checked out the particular Development Object, the necessary library from the central is being copied by DTR to the local environment. However, there are still possibilities that someone changes the library, or other classes that being refered. And we are not talking only about the business logic, but other object in the persistance level too. Let's say your program refered to a certain field in a certain table, but someone else had changed the field name. Or even worse, you want to get the setting value from a certain setting table, but someone else had deleted the value of that record (for whatever reason).
    In short, I believe there are many 'reconcilliation' process that need to be done when the development environment is not centralized. These problems won't happen in the ABAP world, because you will notice the problem straight away when you activate your component, or test run it. In distributed environment, you will only notice it when you check-in your development object back, but it might be after some time lags, and you might not remember which part need to be taken care of.
    Not only this, the setting of 'correct' IDE environment in each local PC must be done properly. Again, in ABAP you just need to install SAP GUI and it will be your development environment.
    So, I had discussion with a friend of mine, and he asked, why there is no central development environment, like the one in ABAP? Hmm, to be frank, I also don't know. Performance problem? I notice that most IDE in the market based on the assumption that development will be done locally. Or is it for the convenient purpose, so that people can keep the development eventhough there is no connection to central server? But what is the cost for this convenient?
    What other people think?
    rgs,
    Hiroshi
    ps: As you might notice, this thread is not marked as question. I am just curious of what other people think about this issue. There will be no points rewarded for the replies.

    Hello Satya,
    So if it's a 'mere' technical limitation, then there should be a way to create centralized development for Java
    It might be an old mainframe environment, but from the development process point of view, centralized environment offers benefit where lots of versioning problem (library or data dictionary) can be solved.
    I used to work in a distributed development environment to create a web based FI/SD/MM related application. We have tons of classic problem of '<i>it is working in my environment, but not in yours</i>' type of thing. With centralized (read: ABAP), version integrity problem can be reduced to minimum.
    For the NWDI itself, I think SAP now moves toward embracing the open source platform to support the development environment. From what I've understood, Ant, for example will be used as the build tool. My personal opinion is, better if SAP creates it's 'proprietary' environment to centralized the java development process. Then it will save lot's of hidden cost during the implementation of new application/enhancement/maintenance in the whole supply chain.
    rgs,
    hiroshi

  • Can I Open an HTMLHelp (*.CHM) File from Java GUI Application?

    I ussually use Delphi to develop my applications and I can open an HTMLHelp (*.CHM) file from my application. Can you show me the ways to do it from my Java GUI applications?
    Thanks for everyone.
    Budi Raharjo
    http://budiraharjo.blogspot.com

    http://www.google.com/search?q=java+chm
    Seems like there is some 3rd party software available for that.

  • File- Print not working from SQL Developer 1.2.1 Build MAIN-32.13

    File->Print not working from SQL Developer 1.2.1 Build MAIN-32.13.
    I downloaded sqldeveloper-1.2.1.3213.ZIP and extract to a local directory. From the extracted directory I ran ..\sqldeveloper\sqldeveloper.exe from Windows XP sp2. The program itself seems to run just fine but File-Print doesn't do anything. In Help-About, Java Platform is reported as 1.5.0_06 and Oracle IDE is 1.2.1.3213. I'm not sure where to look for what is causing the problem.
    Thanks

    I hadn't tried CTRL-P before but I did today. On the first attempt, I saw a small jump in the memory usage for sqldeveloper.exe as reported in Windows Task Manager. Otherwise, there was no change. A second CTRL-P in the same session produced a further bump but subsequent attempts in the same session produced no further change in CPU or Memory Usage.
    Using Task Manager to monitor this further, I tried File->Print again and saw that sqldeveloper would periodically climb to 1 or 2 percent CPU and consume a little more memory. After a minute or so, though, all activity stops again.
    I do not get a print dialog box from SQLDeveloper using either CTRL-P or File->Print

  • Cannot connect a Java GUI client to an EJB

    I am having problems trying to make a Java GUI client connect to an EJB. I am using JRun4.
    At first, I tried making the Java GUI client a part of the enterprise application that I am building (of which the EJB is a part of). I included the client as a Java module in the application.xml of the enterprise application.
    However, when I try to start the server, containing this application, I get an error saying:
    Application authentication required. Incorrect method call.
    Now when I try to execute the application from the console, it works fine except when it comes to the part when it has to connect to the EJB. At this point I get an java.lang.reflect.UndeclaredThrowableException. Here's the stack trace:
    java.lang.reflect.UndeclaredThrowableException
    at $Proxy1.create(Unknown Source)
    at mds.Caller.actionPerformed(Caller.java:135)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: jrun.ejb.invocation.ContainerNotFoundException: The EJB container for boss-ejb#Boss could not be found.
    at jrun.ejb.invocation.AbstractInvocationProxy.findContainer(AbstractInvocationProxy.java:58)
    at jrun.ejb.invocation.LocalInvocationProxyImpl.invoke(LocalInvocationProxyImpl.java:53)
    at jrun.ejb.invocation.ClientInvocationHandlerImpl.invoke(ClientInvocationHandlerImpl.java:198)
    ... 25 more
    Since the bean is local, I am using a local reference to the bean in the lookup in the code of the client:
    Object o = context.lookup("local/BeanTest")
    I tried to use:
    Object o = context.lookup("java:comp/env/ejb/BeanTest")
    and added an ejb-local-ref in the application-client.xml file of the client. But when I try executing the client in this case, I get an error saying:
    No such binding: ejb
    I wish someone can help me out with this. My main aim is to get the app client talk to the EJB. Thanks a lot in advance.
    Soham

    I am not sure of a tool to view the JNDI tree. I have one in Weblogic console. But you can check the JNDI names with a small sample code.
    import java.util.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    public class TestEnvironment {
        public static void main(String[] args) {
            Context context   = null;
            Object object     = null;
            // Hashtable for environment properties.
            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
            env.put(Context.PROVIDER_URL, "t3://localhost:7001");
            try {
                context   = new InitialContext(env);
                NamingEnumeration enum = context.listBindings("");
                while (enum.hasMore()) {
                    Binding binding = (Binding) enum.next();
                    System.out.println("Name: " + binding.getName());
                    System.out.println("Type: " + binding.getClassName());
                    System.out.println("Value: " + binding.getObject());
            } catch (Exception exception) {
                exception.printStackTrace();
    }Hope this helps.

  • Java DC Build Failed

    I was having problem when building a Java DC for JavaBeans (to be exported to Web Dynpro DC). Therefore, there is only one Java class which has the getter and setter there.
    I <b>do not have a DTR installed</b>, so the DC was created under Local DCs -> Local Development -> MyComponents.
    The build log error is as below:
    Dec 1, 2006 10:51:46 AM /userOut/Development Component (com.sap.ide.eclipse.component.provider.listener.DevConfListener) [Thread[ModalContext,5,main]] ERROR: jbmodel: Build failed for sap.com/jbmodel(MyComponents) in variant "default": Used component not found: sap.com/tc/bi/bp/javaLib
    Build log -
    Dec 1, 2006 10:51:46 AM /userOut/Development Component (com.sap.ide.eclipse.component.provider.listener.DevConfListener) [Thread[ModalContext,5,main]] ERROR: jbmodel: Build failed for sap.com/jbmodel(MyComponents) in variant "default": Check for used DCs failed: Used component not found: sap.com/tc/bi/bp/javaLib. DC not found in DC syncdb
    Build log -
    Development Component Build (2006-12-01 10:51:46)
      Component name: jbmodel
      Component vendor: sap.com
      SC compartment: MyComponents
      Configuration: LocalDevelopment
      Location: local
      Source code location: julius.hock@julius
      DC root folder: C:\Documents and Settings\julius.hock\.dtc\LocalDevelopment\DCs\sap.com\jbmodel\_comp\
      DC type: Java
      Host: julius
    DC Model check:
              [dcmake] All used DCs are available locally
              [dcmake] ERROR: Check for used DCs failed: Used component not found: sap.com/tc/bi/bp/javaLib. DC not found in DC syncdb
              [dcmake] Build failed with errors.
    Any help would be appreciated. Thanks.

    Hi Denis,
    go to eclipse plugins folder and into 'com.sap.tc.ap/comp/SAP_BUILDT/DCs/sap.com/tc/bi/bp' and check if u have folder 'javaLib' with build plugin.
    <b>Ans: Yes, javaLib is there. Do you meant i need to add javalibplugin.jar to the Java Build Path?</b>
    then go to 'com.sap.tc.ap/SCs/sap.com/SAP_BUILDT/_comp/TopLevelDCs
    and check if you have 'sap.com tc bi bp javaLib.dcref' file here - if not create it
    <b>Ans: It's alrdy there.</b>
    In my local development, SAP_BUILDT, SAP_JTECHS, SAP-JEE are without any child.
    How shld i proceed?

Maybe you are looking for

  • In c #, when you add a form error supertabcontrol

    c # has been added to the form in the same form again at devcomponents supertabcontrol no longer included, but how should I do the following code error please help.This code is how it should be edited. the codes are as follows;

  • Landline still not working after 1 week, dsl was out ~2 days but back online

    I'm in northern virginia (arlington); sometime last Sunday (8/28) we lost our landline.  yet, dsl was working fine.  verizon self-help diagnosis indicated landline problems, so I put a ticket in for service for following friday (9/02); but service te

  • To do before installing mavericks

    Just wondering if other than backing up system if there are other to do tips to help facilitate a better install experience of Mavericks

  • Communicating with a 3rd party system using webservices

    Hi all, I have a scenario      3rd party <-> XI<->CRM. here im using SOAP between 3rd party <->XI, xi<->CRM im using ABAP proxies. scenario 1. 3rd party would send messages(client request) to cRM to get some data. CRM has to respond for that. scenari

  • Why i cannot open my siri? can anyone help?

    i can open my Siri before. But after i switch off it , the iPhone is not allow me to switch on again.,.. i tried to switch it on , but the IPhone switch it off automatically.. can anyone help me? what should i do?