Java Swing Programming Interview Questions and Answers Guide
Total Page:16
File Type:pdf, Size:1020Kb
Load more
Recommended publications
-
Java Programming Language, Java SE 6
Java Programming Language, Java SE 6 Electronic Presentation SL-275-SE6 REV G.2 D61748GC11 Edition 1.1 Copyright © 2008, 2010, Oracle and/or its affiliates. All rights reserved. Disclaimer This document contains proprietary information, is provided under a license agreement containing restrictions on use and disclosure, and is protected by copyright and other intellectual property laws. You may copy and print this document solely for your own use in an Oracle training course. The document may not be modified or altered in any way. Except as expressly permitted in your license agreement or allowed by law, you may not use, share, download, upload, copy, print, display, perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization of Oracle. The information contained in this document is subject to change without notice. If you find any problems in the document, please report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not warranted to be error-free. Sun Microsystems, Inc. Disclaimer This training manual may include references to materials, offerings, or products that were previously offered by Sun Microsystems, Inc. Certain materials, offerings, services, or products may no longer be offered or provided. Oracle and its affiliates cannot be held responsible for any such references should they appear in the text provided. Restricted Rights Notice If this documentation is delivered to the U.S. Government or anyone using the documentation on behalf of the U.S. Government, the following notice is applicable: U.S. -
100% Pure Java Cookbook Use of Native Code
100% Pure Java Cookbook Guidelines for achieving the 100% Pure Java Standard Revision 4.0 Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, California 94303 USA Copyrights 2000 Sun Microsystems, Inc. All rights reserved. 901 San Antonio Road, Palo Alto, California 94043, U.S.A. This product and related documentation are protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or related documentation may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Restricted Rights Legend Use, duplication, or disclosure by the United States Government is subject to the restrictions set forth in DFARS 252.227-7013 (c)(1)(ii) and FAR 52.227-19. The product described in this manual may be protected by one or more U.S. patents, foreign patents, or pending applications. Trademarks Sun, the Sun logo, Sun Microsystems, Java, Java Compatible, 100% Pure Java, JavaStar, JavaPureCheck, JavaBeans, Java 2D, Solaris,Write Once, Run Anywhere, JDK, Java Development Kit Standard Edition, JDBC, JavaSpin, HotJava, The Network Is The Computer, and JavaStation are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and certain other countries. UNIX is a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd. All other product names mentioned herein are the trademarks of their respective owners. Netscape and Netscape Navigator are trademarks of Netscape Communications Corporation in the United States and other countries. THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. -
APPENDIX a the Java API Packages
APPENDIX A The Java API Packages The JDK provides many packages (JDK 1.1 had 26 packages) and others are being developed (such as the 2D, 3D and Media packages). You must prefIx the names of the packages in Table A.I with "java.". TABLE A.1 The Java API packages PackaKe name Contents applet Applet related classes awt Platform-independent windowing classes awt.datatransfer Support for cut and paste style operations awt.event DeleKation event model classes awt.image Image manipulation classes awt.peer Native windowing facilities classes beans Beans facilities for developers io Input and output classes lang Basic Java classes lang. reflect Java reflection classes math BigDecimal and BigInteger classes net Java networking facilities rmi Remote method invocation classes rmi.dgc Distributed garbage collection rmi.registry Facilities for mapping names to remote objects rmi.server Facilities for the server side of RMI security Java Security for signed applets security.acl Access control list security. interfaces Digital Signature Algorithm interface specifIcations sql JDBC SQL interface classes text Internationalization facilities 428 Java and Object Orientation util General utili classes util.zip Java Archive (JAR) su ort classes For further information on these packages, see books such as Chan and Lee (1996) and Gosling and Yellin (1996). APPENDIXB The java.lang Package B.l INTRODUCTION The java. lang package contains the classes and interfaces which are the basis of the Java environment (as distinct from the Java language). For example, the class Obj ect (the root of all classes) is defined in this package. This package is automatically imported into every Java program (whether it is an application or an applet). -
Mac OS X for Java™ Geeks by Will Iverson
[ Team LiB ] • Table of Contents • Index • Reviews • Reader Reviews • Errata Mac OS X for Java™ Geeks By Will Iverson Publisher : O'Reilly Pub Date : April 2003 ISBN : 0-596-00400-1 Pages : 296 Mac OS X for Java Geeks delivers a complete and detailed look at the Mac OS X platform, geared specifically at Java developers. Programmers using the 10.2 (Jaguar) release of Mac OS X, and the new JDK 1.4, have unprecedented new functionality available to them. Whether you are a Java newbie, working your way through Java Swing and classpath issues, or you are a Java guru, comfortable with digital media, reflection, and J2EE, this book will teach you how to get around on Mac OS X. You'll also get the latest information on how to build applications that run seamlessly, and identically, on Windows, Linux, Unix, and the Mac. [ Team LiB ] [ Team LiB ] • Table of Contents • Index • Reviews • Reader Reviews • Errata Mac OS X for Java™ Geeks By Will Iverson Publisher : O'Reilly Pub Date : April 2003 ISBN : 0-596-00400-1 Pages : 296 Copyright Preface Organization Conventions Used in This Book Comments and Questions Acknowledgments Chapter 1. Getting Oriented Section 1.1. All Those Confusing Names Section 1.2. Why Now? Chapter 2. Apple's Java Platform Section 2.1. Apple JVM Basics Section 2.2. Apple's JVM Directory Layout Section 2.3. Additional APIs and Services Section 2.4. Going Forward Chapter 3. Java Tools Section 3.1. Terminal Section 3.2. Code Editors Section 3.3. Jakarta Ant Section 3.4. -
Java Programming [R17a0507]
JAVA PROGRAMMING [R17A0507] LECTURE NOTES B.TECH II YEAR – II SEM (R17) (2018-19) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING MALLA REDDY COLLEGE OF ENGINEERING & TECHNOLOGY (Autonomous Institution – UGC, Govt. of India) (Affiliated to JNTUH, Hyderabad, Approved by AICTE - Accredited by NBA & NAAC – ‘A’ Grade - ISO 9001:2015 Certified) Maisammaguda, Dhulapally (Post Via. Hakimpet), Secunderabad – 500100, Telangana State, INDIA. MALLA REDDY COLLEGE OF ENGINEERING & TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING (R17A0507)JAVA PROGRAMMING Objectives: This subject aims to introduce students to the Java programming language. Upon successful completion of this subject, students should be able to create Java programs that leverage the object-oriented features of the Java language, such as encapsulation, inheritance and polymorphism; use data types, arrays and other data collections; implement error-handling techniques using exception handling, create and event-driven GUI using Swing components. UNIT-I OOP Concepts:- Data abstraction, encapsulation, inheritance, Benefits of Inheritance, Polymorphism, classes and objects, Procedural and object oriented programming paradigms. Java Programming- History of Java, comments, Data types, Variables, Constants, Scope and Lifetime of variables, Operators, Operator Hierarchy, Expressions, Type conversion and casting, Enumerated types, Control flow- block scope, conditional statements, loops, break and continue statements, simple java stand alone programs, arrays, console input and output, formatting output, constructors, methods, parameter passing, static fields and methods, access control, this reference, overloading methods and constructors, recursion, garbage collection, building strings, exploring string class. UNIT – II Inheritance – Inheritance hierarchies super and sub classes, Member access rules, super keyword, preventing inheritance: final classes and methods, the Object class and its methods. Polymorphism – dynamic binding, method overriding, abstract classes and methods. -
2D Animation of Recursive Backtracking Maze Solution Using Javafx Versus AWT and Swing
2020 International Conference on Computational Science and Computational Intelligence (CSCI) CSCI-ISSE Full/Regular Research Paper 2D Animation of Recursive Backtracking Maze Solution Using JavaFX Versus AWT and Swing Anil L. Pereira School of Science and Technology Georgia Gwinnett College Lawrenceville, GA, USA [email protected] Abstract—This paper describes software developed by the AWT and Swing have been used widely in legacy software author, that constructs a two-dimensional graphical maze and uses [8]. Even though, software developers claim that there is a steep animation to visualize the recursive backtracking maze solution. learning curve for JavaFX [9], applications using AWT and The software is implemented using three Java graphics Swing are being rewritten with JavaFX. This is because of technologies, Java Abstract Window Toolkit, Java Swing and JavaFX’s look and feel and other features mentioned above. JavaFX. The performance of these technologies is evaluated with Also, the performance is claimed to be better, due to its graphics respect to their graphics rendering frame rate and heap memory rendering pipeline for modern graphics processing units (GPUs) utilization. The scalability of their rendering performance is [10]. This pipeline is comprised of: compared with respect to maze size and resolution of the displayed • A hardware accelerated graphics pipeline called Prism maze. A substantial performance gap between the technologies is reported, and the underlying issues that cause it are discussed, • A windowing toolkit for Prism called Glass such as memory management by the Java virtual machine, and • A Java2D software pipeline for unsupported graphics hardware accelerated graphics rendering. hardware • High-level support for making rich graphics simple Keywords—graphics; animation; JavaFX; Swing; AWT with Effects and 2D and 3D transforms I. -
Manning Publications, Inc
Preface An “early technology adopter” (also known as a techno-geek) like myself is usually ready to evaluate an exciting new API the day it is released (if not sooner). In late 1994, while attending a software developers’ conference in California, I encountered a past acquaintance who, at the time, was employed by Sun Microsystems. As I am apt to do, I began complaining to him about the generally inadequate state of the business, and, in particular, the coding effort and portability weaknesses in languages such as C and C++. After listen- ing to my droning for a while, my friend told me about a particularly interest- ing programming language coming from Sun Microsystems in just a couple of months. A new language from Sun? Aren’t they a UNIX workstation com- pany? What does a hardware company know about building computer lan- guages? I was skeptical about trying to use any language produced by Sun Microsystems. The language my friend was referring to was Java 1.0, which, as he pre- dicted, was shipped at the beginning of 1995. In late January of 1995, I con- nected to Sun’s World Wide Web site, pulled down the first version of the Java Development Kit (JDK), and immediately began tinkering. Although I didn’t yet understand the overall vision of Java, I was impressed with the platform independence, and with the speed at which I could build relatively complex prototypes. In these early stages, I viewed Java as a replacement for Microsoft’s Visual Basic as a prototyping tool; however, I was soon to appreci- ate the capabilities of this new language. -
Solaris Java Plug-In User's Guide
Solaris Java Plug-in User’s Guide Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, CA 94303-4900 U.S.A. Part No: 806-1636–10 February 2000 Copyright 2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California 94303-4900 U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, docs.sun.com, AnswerBook, AnswerBook2, Java, JDK, JavaBeans, and Solaris are trademarks, registered trademarks, or service marks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. Netscape Navigator is a trademark or registered trademark of Netscape Communications Corporation. The OPEN LOOK and SunTM Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. -
Java Look and Feel Design Guidelines
User interface guidelines for designers of applications TM based on the JAVA JavaTM Foundation Classes LOOK AND FEEL DESIGN GUIDELINES JAVA™ LOOK AND FEEL DESIGN GUIDELINES Please send your email feedback to us at [email protected] JAVA™ LOOK AND FEEL DESIGN GUIDELINES Sun Microsystems, Inc. Addison-Wesley An imprint of Addison Wesley Longman, Inc. Reading, Massachusetts • Harlow, England • Menlo Park, California Berkeley, California • Don Mills, Ontario • Sydney • Bonn Amsterdam • Tokyo • Mexico City Copyright 1999 Sun Microsystems, Inc., 901 San Antonio Road, Copyright 1999 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California 94303 U.S.A. All rights reserved. Palo Alto, Californie 94303 Etats-Unis. Tous droits réservés. This product or documentation is protected by copyright and Ce produit ou document est protégé par un copyright et distribué distributed under licenses restricting its use, copying, avec des licences qui en restreignent l’utilisation, la copie, la distribution, and decompilation. No part of this product or distribution, et la décompilation. Aucune partie de ce produit ou documentation may be reproduced in any form by any means document ne peut être reproduite sous aucune forme, par without prior written authorization of Sun and its licensors, if any. quelque moyen que ce soit, sans l’autorisation préalable et écrite Third-party software, including font technology, is copyrighted de Sun et de ses bailleurs de licence, s’il y en a. Le logiciel détenu and licensed from Sun suppliers. par des tiers, et qui comprend la technologie relative aux polices de caractères, est protégé par un copyright et licencié par des Sun, Sun Microsystems, the Sun logo, Java, JavaHelp, Java 2D, fournisseurs de Sun. -
Introduction to the Java Foundation Classes
Introduction to the Java Foundation Classes Topics in This Chapter • The History of the Java Foundation Classes • Overview of JFC Features • The Swing Packages • Look-and-Feel and the Model-View-Controller Architecture 1 ChapterChapter he Java Foundation Classes bring new capabilities to the Java programmer, foremost among which are the components in the so-called Swing set. This Tchapter begins by looking briefly at the history of the Java programming lan- guage and of the Abstract Window Toolkit in particular. The Abstract Window Toolkit, or AWT for short, provides the classes used to build an application’s user interface. In both Java Development Kit (JDK) 1.0 and JDK 1.1, Java applications running under Windows looked just like Windows programs, while those running on Solaris looked the same as native applications written with the Motif toolkit. The reason for this was simply that much of the AWT is provided by code from the native platform’s window- ing system—the user interface components are rendered by Windows or by Motif, not by Java code. While this has its advantages, it also has drawbacks. For one thing, it is difficult to implement a single interface and map it to two (or more) host platforms that work differently. And even when you’ve done that, the controls themselves behave somewhat differently between the platforms. Because this behavior is part of the native windowing system, there’s nothing you can do about it. Implementing all of the user interface classes in Java gets rid of these problems at a stroke. That’s exactly what the Swing components, which are the most significant part of the Java Foundation Classes (JFC), do—they replace the native implementa- tion with a user interface library that works the same on all Java platforms. -
Java Programming Language
Sun Educational Services Java Programming Language SL-275 Sun Educational Services Java Programming Language September 1999 Copyright 1999 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California 94303, U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun Logo, Solstice, Java, JavaBeans, JDK, and Solaris are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trade- marks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements. -
An Introduction to Java Swing TAKE IT to the NTH
TAKE IT TO THE NTH An Introduction to Java Swing TAKE IT TO THE NTH Asif Habibullah Member of Technical Staff, Software Market Development Engineering In Introduction to Java Swing An Introduction to Java Swing • What is Java Swing? • Swing GUI Fundamentals • Swing Components • Event Handling • Model-View-Controller (MVC) Design Pattern • Rich clients for Web Services • Deploy via Java Web Start What is Java Swing? • Graphical User Interface (GUI) component toolkit. • Complete set of user-interface elements written entirely in Java. • Integrated into the Java 2 platform (1.2 or higher). • No need to download and install on Java 2 platform. • If running Java 1.1, you can download and install separately. • Part of Java Foundation Classes (JFC) Java Foundation Classes (JFC) The Java Foundation Classes (JFC) extend the original Abstract Window Toolkit (AWT) by adding a comprehensive set of graphical user interface class libraries • What makes up the JFC (features)? • Swing • Accessibility API • Java 2D API • Drag and Drop API • AWT • Internationalization What about AWT? Swing AWT • Lightweight components • Heavyweight components • Complex components • Primitive components • Pluggable Look and Feel • Single Look and Feel • Pure Java – Platform • Not Pure Java – Platform independent dependent Lightweight vs. Heavyweight Lightweight Heavyweight • Not dependent on native peers • Dependent on native peers • Rely on primitive Java drawing • Rely on native windowing techniques in rendering. system in rendering. • Components behavior is the • Component behavior may same across platforms. differ across platforms. • Look and Feel is independent • Look and feel is dependent of platform on platform Swing GUI Fundamentals • Swing components • Containers • Non-containers • Layout Mangers • Event Handling Swing Containers Used to hold other Swing containers and components.