use of cbit.image.DisplayAdapterService in project vcell by virtualcell.
the class ImagePaneScrollerTest method main.
/**
* Starts the application.
* @param args an array of command-line arguments
*/
public static void main(java.lang.String[] args) {
// Insert code to start the application here.
// Create default image
int w = Integer.valueOf(args[2]).intValue();
int h = Integer.valueOf(args[3]).intValue();
String type = args[0];
SourceDataInfo sdi = getExampleSDI(type, w, h);
DisplayAdapterService das = null;
if (type.equals("double")) {
das = new DisplayAdapterService();
das.setActiveScaleRange(new Range(0, 450));
das.setValueDomain(new Range(-50, 550));
das.addColorModelForValues(DisplayAdapterService.createGrayColorModel(), DisplayAdapterService.createGraySpecialColors(), DisplayAdapterService.GRAY);
das.addColorModelForValues(DisplayAdapterService.createBlueRedColorModel(), DisplayAdapterService.createBlueRedSpecialColors(), DisplayAdapterService.BLUERED);
das.setActiveColorModelID(DisplayAdapterService.GRAY);
} else if (type.equals("index")) {
das = new DisplayAdapterService();
das.addColorModelForIndexes(DisplayAdapterService.createGrayColorModel(), DisplayAdapterService.GRAY);
das.addColorModelForIndexes(DisplayAdapterService.createBlueRedColorModel(), DisplayAdapterService.BLUERED);
das.setActiveColorModelID(DisplayAdapterService.GRAY);
}
try {
javax.swing.JFrame frame = new javax.swing.JFrame();
ImagePaneScroller aImagePaneScroller;
aImagePaneScroller = new ImagePaneScroller();
aImagePaneScroller.getImagePaneModel().setSourceData(sdi);
aImagePaneScroller.getImagePaneModel().setDisplayAdapterService(das);
// aImagePaneScroller.getImagePaneModel().setBackgroundColor(java.awt.Color.yellow);
if (args[1].equals("true")) {
aImagePaneScroller.getImagePaneModel().setMode(ImagePaneModel.MESH_MODE);
}
javax.swing.JPanel jp = new javax.swing.JPanel();
jp.setLayout(new java.awt.BorderLayout());
jp.add(aImagePaneScroller);
frame.setContentPane(jp);
frame.setSize(aImagePaneScroller.getSize());
frame.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
frame.show();
java.awt.Insets insets = frame.getInsets();
frame.setSize(frame.getWidth() + insets.left + insets.right, frame.getHeight() + insets.top + insets.bottom);
frame.setVisible(true);
} catch (Throwable exception) {
System.err.println("Exception occurred in main() of javax.swing.JPanel");
exception.printStackTrace(System.out);
}
}
Aggregations