tesseract
3.03
|
00001 // Copyright 2007 Google Inc. All Rights Reserved. 00002 // 00003 // Licensed under the Apache License, Version 2.0 (the "License"); You may not 00004 // use this file except in compliance with the License. You may obtain a copy of 00005 // the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 00006 // applicable law or agreed to in writing, software distributed under the 00007 // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 00008 // OF ANY KIND, either express or implied. See the License for the specific 00009 // language governing permissions and limitations under the License. 00010 00011 package com.google.scrollview.ui; 00012 00022 import com.google.scrollview.ScrollView; 00023 import com.google.scrollview.events.SVEvent; 00024 import com.google.scrollview.events.SVEventType; 00025 00026 import javax.swing.JCheckBoxMenuItem; 00027 00031 class SVCheckboxMenuItem extends SVAbstractMenuItem { 00032 public String value = null; 00033 public String desc = null; 00034 public boolean bvalue; 00035 00036 SVCheckboxMenuItem(int id, String name, boolean val) { 00037 super(id, name, new JCheckBoxMenuItem(name, val)); 00038 bvalue = val; 00039 } 00040 00042 @Override 00043 public void performAction(SVWindow window, SVEventType eventType) { 00044 // Checkbox entry - trigger and send event. 00045 if (bvalue) { 00046 bvalue = false; 00047 } else { 00048 bvalue = true; 00049 } 00050 SVEvent svme = new SVEvent(eventType, window, id, getValue()); 00051 ScrollView.addMessage(svme); 00052 } 00053 00055 @Override 00056 public String getValue() { 00057 return Boolean.toString(bvalue); 00058 } 00059 } 00060