In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
How to analyze the development of Swing project, I believe that many inexperienced people are at a loss about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
As the work recently took over a Swing project, the development cycle is one year, which is not a small project, and I am in charge of the project. (* ^ _ ^ *) hee hee. I will write down my experience of development and management. I welcome all experts and seniors to criticize and correct me.
Preparation before project development:
A: first of all, for the tool now, eclispe,netbeans,jb, etc., for eclipse, we need to install a plug-in swt-designer, netbeans can be developed directly, sun company has done it for us, we need to say that eclipse does not support dynamic layout, but it is possible to run the project under netbeans under import to eclipse.
B: for Swing projects, without a good naming convention, especially in many people to participate in the development, it will be very bad, there are a large number of components in Swing is also very troublesome to use, here I write a simple example, such as JTextField txtFieldName, JTextArea txtBlog, etc., so that it can facilitate development and communication.
C: for the determination of tools, netbeans is a good choice for interface development, but it is weak for background development. Here I choose eclipse as the background development, it is best to type the developed program into the jar file * * and then import it into netbeans.
Design related to project development
For Swing to make the interface, it is not as easy as we thought. For example, we have drawn all the interfaces in netbeans. When you open the source file of the interface, you will find that the file is very large, there may be tens of thousands of lines of code or more. You may feel at a loss when you read this code. There is even the idea of smashing the computer, when the maintenance personnel see such code, we can imagine the situation at that time, and there are many complex events in Swing, which is also a challenge to our developers themselves. We have to rummage through tens of thousands of lines of code, is there any good way to solve it? Actually, there is.
In fact, we develop in the face of component development, and then we integrate the various components together to become the software we need, and when we develop it, we are bound to encounter this or that.
JPane, JFrom JTable, etc., we can reassemble individual jpane,jfrom jtable into our own components for reuse, and we combine these components into the main Pane. The following example is developed by me with netbeans:
Package singlepane; import org.jdesktop.application.Action; import org.jdesktop.application.ResourceMap; import org.jdesktop.application.SingleFrameApplication; import org.jdesktop.application.FrameView; import org.jdesktop.application.TaskMonitor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; import javax.swing.Icon; import javax.swing.JDialog; import javax.swing.JFrame; import org.flybird.plat.SingleJpane; / * * The application's main frame. * / public class SinglePaneView extends FrameView {public SinglePaneView (SingleFrameApplication app) {super (app); initComponents ();} / * * This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. * / private void initComponents () {mainPanel = new javax.swing.JPanel (); mainPabbedPane = new javax.swing.JTabbedPane (); this.singleJpane = new SingleJpane (); savePanel = new javax.swing.JPanel (); mainPanel.setName ("mainPanel"); / / NOI18N mainPabbedPane.setName ("mainPabbedPane"); / / NOI18N savePanel.setName ("savePanel"); / / NOI18N org.jdesktop.layout.GroupLayout savePanelLayout = new org.jdesktop.layout.GroupLayout (savePanel); savePanel.setLayout (savePanelLayout) SavePanelLayout.setHorizontalGroup (savePanelLayout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING) .add (0371, Short.MAX_VALUE)); savePanelLayout.setVerticalGroup (savePanelLayout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING) .add (0273, Short.MAX_VALUE)); org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance (singlepane.SinglePaneApp.class) .getContext () .getResourceMap (SinglePaneView.class) MainPabbedPane.addTab (resourceMap.getString ("savePanel.TabConstraints.tabTitle"), savePanel); / / NOI18N mainPabbedPane.addTab ("single", this.singleJpane); org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout (mainPanel); mainPanel.setLayout (mainPanelLayout) MainPanelLayout.setHorizontalGroup (mainPanelLayout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING) .add (mainPanelLayout.createSequentialGroup () .add (mainPabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE) .add (24,24,24) MainPanelLayout.setVerticalGroup (mainPanelLayout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING) .add (org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup () .add (20,20,20) .add (mainPabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300,300, Short.MAX_VALUE)); setComponent (mainPanel);} / Variables declaration-do not modify private javax.swing.JTabbedPane mainPabbedPane; private javax.swing.JPanel mainPanel; private javax.swing.JPanel savePanel / / End of variables declaration private SingleJpane singleJpane;} after reading the above, have you mastered the method of how to analyze the development of Swing project? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.