devxlogo

Tip Bank

Appending Data to an Existing File

There is a constructor in the java.io.FileOutputStream class which can be used to append data to an existing file. Usage:public FileOutputStream(String name, boolean append) throwsFileNotFoundExceptionwhere:name – the file nameappend –

How to Make a Swing Component Appear and Disappear

Here’s a very short bit of code that will make a StatusBar hide or show, accordingly: public void viewStatusBar() { /* Hide or show the statusbar */ StatusBarPane().setVisible(!(StatusBarPane().isVisible()));} Just have

Encapsulate Member Objects

Objects frequently contain member objects that need to be exposed.Often, these are not correctly encapsulated, which could lead to problems that are difficult to track down.Consider a Circus object, which

Communicating With XML Files

Start a new VB project. Add a form (or use the default one). Then, add these four buttons on the form: create (cmdCreateFile), read (cmdRead), append (cmdAppend), and delete (cmdDelete).

Avoid Hungarian Notation in Public Interfaces

Most coding standards recommend the use of Hungarian variable naming, which uses prefixes to indicate the variable’s type. However, these naming conventions usually should not be used in a component’s