Embedded font flips in combo box
I have an Flash builder 4 project with 3.5 backwards compatibility
i'm using an mx combobox. as soon as i set an embedded font to it, the drop down gets flipped as if xScaled to -1
i'm embedding my font like this
@font-face {
src: url('../libs/fonts/helvetica/HelveticaNeueLTStd-Roman.otf');
fontFamily: "_HELVETICA NEUE LT";
@font-face {
src: url('../libs/fonts/helvetica/HelveticaNeueLTStd-Bd.otf');
fontFamily: "_HELVETICA NEUE LT";
fontWeight: bold;
/* CSS Document */
Canvas {
font-family: "_HELVETICA NEUE LT";
font-size: 16px;
color: #333333;
and all i have on my application is this
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
layout="absolute"
width="1400" height="768"
frameRate="99"
backgroundColor="#000000"
backgroundGradientColors="#000000,#000000">
<fx:Style source="../libs/MXMLStyles.css"/>
<mx:Canvas>
<mx:ComboBox dataProvider="{['a','b','c']}"/>
</mx:Canvas>
</mx:Application>
Hi,
You are using flex 3 (sdk 3.5), fx tag is flex 4.
Call your css file like this:
<mx:Style source="../libs/MXMLStyles.css"/>
Here is a help for css
http://examples.adobe.com/flex2/consulting/styleexplorer/Flex2StyleExplorer.html
Rgds
Johnny
Similar Messages
-
Input Controls - is it possible to change the font for a combo box
I have an input Control combo box that is a mixture of english/chinese characters. In Webi I can view the chinese characters correctly if I change the font to MingLIU. Is it possible to change the font for an input control OR to set a default font?
I am a first-time user of the photo book application in iPhoto.
I also was a first-time user, so I started using it. Exploring the possibilities, learning my way around.
Thanks, in advance, for any suggestions someone might have.
Click the ? icon
Oops. Sorry, but you're in the wrong forum : iLife > iPhoto -
Embeded Fonts and Externally Loaded Text?
Just curious, I am designing a site with two embeded fonts. I am also using many externally loaded textboxes styled by a CSS. When I use the inline HTML in the .txt file, can I specify the embeded fonts for the text boxes or will they just use default browser fonts?
Thanks in advance,
JeffI think what I need to do is place an instance of a text box on each page, so when you navigate away from the page the existing text box will leave. This works, but I can't get the CSS to do the formatting. Here is the code I have, any suggestions?
var fileTxt:String;
var myTextLoader:URLLoader = new URLLoader();
var cssLoader:URLLoader = new URLLoader();
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
myTextLoader.load(new URLRequest("text/tgc.txt"));
function onLoaded(e:Event):void{
fileTxt=myTextLoader.data;
callCss();
function callCss():void{
var cssRequest:URLRequest=new URLRequest("styles.css");
cssLoader.addEventListener(Event.COMPLETE, onCss);
cssLoader.load(cssRequest);
function onCss(e:Event):void{
var css:StyleSheet = new StyleSheet();
css.parseCSS(cssLoader.data);
tgc_txt.styleSheet=css;
tgc_txt.wordWrap=true;
tgc_txt.htmlText=fileTxt;
Like I said, it loads the text fine and eliminates the embeded HTML tags in the .txt file. It does not change color, size or weight as I have in the CSS. -
Embedded Fonts a Combo Box and complete madness
I have a combo box that has an array of fonts loaded into
them, not here is my problem. For some reason, when i select the
fonts in the array, some of them change and some of them dont. I
have created font symbols like instructed in the live docs, but i
dont get why they arent showing up..
i.e. I have 7 fonts loaded into this combo box and i can
select Arial Bold and my text field will show the text in arial
bold, but when i select hobo, i get some substitute!
here's my code, maybe you guys will see something i
haven't.. the fonts in particular i am having trouble with: Bookman
Old Style, BrushScript and Hobo.there are many points/issues here. here are some:
1. Your array called fonts contains eight strings such as
'new Arial()', whereas i think what you were trying to achieve here
is to create references to the fonts in the library. to do this
remove the quotation marks.
2. To be able to create references to the fonts in the
library, ensure that the font symbols in the library contain class
names, with base classes of flash.text.Font. do this by selecting
'Linkage' on your library fonts.
3. Ensure that your text field is set to embed fonts - either
in authoring, or with actionscript
eg.outputTB1.embedFonts=true;
4. you set up fonts_array with eight font names and then in
your for loop, you again add eight fonts to this array. this is
redundant.
5. in the for loop you have the line: fonts_array.push(new
String(fonts[ i]));
this appears to be an attempt at converting a reference to a
font into a font name. this isn't going to work. if you had set up
references to fonts to begin with (see point 1), and this line
wasn't redundant (see point 4), you would extract the font name
like so: fonts_array.push(fonts[ i].fontName)
6. maintaining two arrays of fonts is unecessary. i would
recommend just maintain your fonts array with references to fonts,
and extract font names from these references. this would look
something like the code attached below.
7. One last thing - i notice that you have at least two of
your fonts - arial and arial bold, probably have different
formatting. if some are bold and some are not, you will need to
specify the bold property also. eg. font.bold=true -
Combo Box initial font/colour
Hello - so i'm making a simple email form in flash and am
having problems
with my combo box. I have managed to make is to the drop-down
list is the
embedded font I want and have been able to change the font
colour, select
colour, drop-down border - but I can't figure out how to
change the font +
colour of the initial state of the drop-down on the screen
before it is
clicked .. or what it looks like after it's been clicked and
closes up...
you can see what I talking about at :
63.134.206.80/FRAM-email.html
Does anyone have any advice?
Thanks
TimTry this:
import mx.styles.CSSStyleDeclaration;
_global.styles.ComboBox = new CSSStyleDeclaration();
_global.styles.ComboBox.setStyle("fontFamily","AAA");
Tim -
Hi
I changed the font using
_global.styles.ComboBox.fontFamily = "AAA";
where ASU is an embedded font
The font displays correctly when the combo box is open but
closed it still show the default _sans
Anyone help on changing the display font when closed?
Many thanks
MarkTry this:
import mx.styles.CSSStyleDeclaration;
_global.styles.ComboBox = new CSSStyleDeclaration();
_global.styles.ComboBox.setStyle("fontFamily","AAA");
Tim -
A Combo box has robbed me of my font!
Here's a good one for you ...
I have a textFlow running through columns with a nice embedded font. Looks lovely. I then decide to add a completely unrelated Combo box to my app ... and now the textFlow doesn't render with the font. Comment out the combo and the font returns.
I don't even know where to start with that one.
I ran some tests and even with a completely dumb combo added with no DP it robs me of my font.
This is now officially MENTAL!Hi Robin. I believe that this may be related to the Combo Box (which is a Spark combo) overriding my default TextFlow configuration. Here's how I'm formatting my TextFlow ...
Code snippet - Creating a TextFlow Configuration object on Snipplr
I'll run some tests to see if I can format the TF without using a default config. -
LOV's in form combo box - how to change font size?
Greetings:
I've a table generated form (custom vs. tabular), with a combo-box field that fills with a LOV's that has as it's visible data, a rather long concatenated string. Therefore, this field makes the entire form rather wide when the LOV's contains a long string (as returned from the SQL that gathers the data).
I've tried using the FONT tag in the 2nd tab (Form wizard) for custom layouts; that didn't work.
Anyone have ideas for decreasing the font size of the LOV's? Else, I'll have to leave-out some of the info concatenated on that string.
As always, thanks for you continued guidance and support...
Ed in TampaHi,
Changing the font size and other properties like font color, width, height, etc.. of the form elements can be achieved by using Cascading Style Sheet (CSS).
It cannot be changed using <FONT> tag.
In Portal, one can add the CSS attribute to the HTML tags in the custom layout of the form. But adding the CSS attribute to FORM elements (Input, select..)is not possible through Form wizards.
However, this can be achieved by creating a form through the Dynamic Page. In this case you have to define your whole form.
To know more about CSS you can visit: http://www.mako4css.com
Thanks,
Shivank -
I tryed posting this question before with no success, so I
thought I would
re-explain.
i am using a combo box component (using flash mx 2004 pro)
and have been
able to customize the fonts, colour, etc. of the list once
the user clicks
on the combo box, but can not figure out how to make the
initial combox
box text use the embedded font. Any suggestions?
You can see the combo box in question at :
63.134.206.80/FRAM-email.html
thank you
TimThanks, that worked great! one more quick question, is there
a way to
actionscript the component so that the comboc box doesn't
have rounded
corners when it's not selected?
In article <f2955i$7q1$[email protected]>,
"proPingu"
<[email protected]> wrote:
> _global.style.setStyle("color", 0x0000FF);
> _global.style.setStyle("themeColor", 0xFFCC00);
> _global.style.setStyle("fontSize",12);
> _global.style.setStyle("fontFamily" , "Century Gothic"); -
Hi I currently have a simple combo box compenent with three options to choose fonts. It works fine when i test it, but it doesnt drop down in the browser.
This is the code
[AS]
LBtextMenu.LBfontList.textField.setStyle("textFormat", tf);
LBtextMenu.LBfontList.dropdown.setRendererStyle("textFormat", tf);
LBtextMenu.LBfontList.addItem( {label: "Arial" } );
LBtextMenu.LBfontList.addItem( {label: "Calibri" } );
LBtextMenu.LBfontList.addItem( {label: "Bauhaus 93" } );
var LBnewFormat:TextFormat = new TextFormat();
LBnewFormat.font = "Arial";
LBnewFormat.size = 12;
var LBnewFormat01:TextFormat = new TextFormat();
LBnewFormat01.font = "Bauhaus 93";
LBnewFormat01.size = 12;
var LBnewFormat02:TextFormat = new TextFormat();
LBnewFormat02.font = "Calibri";
LBnewFormat02.size = 12;
LBtextMenu.LBfontList.addEventListener(Event.CHANGE, LBfontSelect);
function LBfontSelect(event:Event){
if (event.target.selectedIndex == 0){
trace("Arial was chosen")
LBTxt.LBOutput.setTextFormat(LBnewFormat)
} if (event.target.selectedIndex == 1) {
trace("Calibri1 was chosen")
LBTxt.LBOutput.setTextFormat(LBnewFormat02);
if (event.target.selectedIndex == 2) {
trace("Bauhaus was chosen")
LBTxt.LBOutput.setTextFormat(LBnewFormat01);
[/AS]
If anyone can help it is greatly appreciated, Thanks.use the swf embedding code published by flash.
if you already are using that html, what's your url and what needs to be done to see the problem, if it's not obvious. -
Unable to apply embedded font swf to text in text layout framework
Hello,
We have created a swf for a given font (for e.g., Calibri.swf) which contains all the styles (Regular, Italic, Bold, BoldItalic).
We have created a xml which lists the name of the font and the corresponding swf file path. The names from the xml are loaded into a combo box in the application.
When we try to apply the selected font to a text in the text layout framework, it does not apply the same. It sets the font to default "Times" font.
Following is a snippet of code to apply the font to the text:
private function selectFont(fontXML:XML):void {
var path:String = fontXML.@source;
var myEvent:IEventDispatcher = styleManager.loadStyleDeclarations(FlexGlobals.topLevelApplication.url.substring(0,FlexGl obals.topLevelApplication.url.lastIndexOf("/"))+"/"+path);
myEvent.addEventListener(StyleEvent.COMPLETE, function(event:StyleEvent):void{
var editManager:EditManager = textFlow.interactionManager as EditManager;
var itextLayout:TextLayoutFormat = new TextLayoutFormat();
itextLayout.fontSize = 20;
var fontName:String = fontXML.@name;
Alert.show(fontName);
itextLayout.fontFamily = fontName;
Alert.show( "itext = " + itextLayout.fontFamily);
editManager.applyFormat(itextLayout,itextLayout,itextLayout);
var flowLeafElement:FlowElement = textFlow.findLeaf(editManager.anchorPosition) as FlowElement;
editManager.changeStyleName(fontName,flowLeafElement);
Can anyone please let us know what is missing in the implementation?
Thanks in advance.
VikramMy recommendation: unless you really care about ISWFContext implementations and the application domain issues, ignore Alex's post about embedded fonts.
It is a nice discussion about the inner workings of the domain and security of how this works but it is imho broken and is an insane concept to require an ISWFContext to just use an embedded font. It also breaks runtime CSS loading that has fonts embedded in it because the Flex compiler (last I checked) was also busted – it doesn't include the function necessary to create within context the font embed so that it may be applied. You can't create an ISWFContext with a compiled CSS file.
These issues were introduced in the last Flex SDK beta before FB4 was released in final form. There are multiple bugs logged against the issue of applying loaded font files to TLF text (in short, SWFContext is broken and you have to override GlobalSettings.resolveFontLookupFunction to return embedded or null, all the time).
Here's some more details to get you started - with links to at least one of the SDK bugs that were filed:
http://forums.adobe.com/message/2656152
For example:
import flashx.textLayout.elements.GlobalSettings;
import flash.text.engine.FontLookup;
GlobalSettings.resolveFontLookupFunction = function makeValid():String { return FontLookup.EMBEDDED_CFF };
And you may need to do this after your font is loaded:
yourTextBlock.textFlow.invalidateAllFormats();
Disclaimer: I haven't seen the latest Flex SDK release to see if this was fixed. I have an AIR application with native process that builds embedded font SWF files for use and stub code for FB4 usage but haven't updated to the latest SDK yet to see if it's working properly.
Anyhow, your best bet is to look at the Flash Builder forums. I think this is/was a Flex team issue, not TLF. -
Looping through an array to get the index for each measure in a combo box
Hi folks,
I am working on a web application that has two combo boxes, one for year (called yearcombo) and for measures (called myURL) for that selected year, and also two radiobuttons (in radioBtnGroup). I have two years and a bunch of measure for each year. I have a map tool tip that when you mouse over the county you see a measure for that specific year. However I have a bunch of measures for each year and I want to be able to loop through the measures (which are in an array collection inside a combobox) so my "if" expression can find every selectedIndex and bring me the tool tip for that selected measure for that selected radio button. Right now I would have to create if statements for each measure (each selectedIndex inside the myURL combobox)and each radiobutton (inside the radioBtnGroup) instead of creating a if expression to get a map tip tool for each measure. I know I would have to create a loop to search for these indexes and enter that in the if expression and also change the graphic.attributes to reflect the right measure or index selected. Do you API for Flex wizards can give me any tips on how to code this according to my code below ? Any help is greatly appreciated! (the print scree is attached)
Below is the code snippet:
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
And below is the combo boxes with the arrays
<mx:FormItem label="Year :" >
<mx:ComboBox id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)" >
<mx:ArrayCollection id="year" >
<fx:Object label="2007" year="2007" />
<fx:Object label="2009" year="2009" />
</mx:ArrayCollection>
</mx:ComboBox>
</mx:FormItem>
<mx:FormItem label="Measure:">
<mx:ComboBox id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
<mx:ArrayCollection id="measures" >
<fx:Object id="forindout07" labeltext="2007 Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007" />
<fx:Object id="foremp07" label="2007 Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
<fx:Object id="forlabinc07" label="2007 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
<fx:Object id="forindbustax07" label="2007 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
<fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009" />
<fx:Object id="foremp09" label="2009 Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
<fx:Object id="forlabinc09" label="2009 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
<fx:Object id="forindbustax09" label="2009 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
<fx:Object id="blank" label=" " />
</mx:ArrayCollection>And here is the entire code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"
paddingBottom="8" paddingLeft="8"
paddingRight="8" paddingTop="8"
backgroundColor="0xffffff"
layout="vertical" >
<!-- Start Declarations -->
<fx:Declarations>
<esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5" color="0x808080">
<esri:SimpleLineSymbol width="0" color="#000000"/>
</esri:SimpleFillSymbol>
<esri:SimpleFillSymbol id="defaultsym" alpha="0.01" color="#E0E0E0" >
<esri:SimpleLineSymbol width="1" color="#000000"/>
</esri:SimpleFillSymbol>
<!-- End Declarations -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.esri.ags.Graphic;
import com.esri.ags.SpatialReference;
import com.esri.ags.esri_internal;
import com.esri.ags.events.GraphicEvent;
import com.esri.ags.geometry.Extent;
import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
import com.esri.ags.symbols.SimpleFillSymbol;
import com.esri.ags.symbols.SimpleLineSymbol;
import flash.utils.flash_proxy;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.RadioButton;
import mx.controls.TextArea;
import mx.events.DropdownEvent;
import mx.events.ItemClickEvent;
import mx.rpc.Fault;
import mx.rpc.events.FaultEvent;
import flash.display.Sprite;
import flash.events.ErrorEvent;
import flash.events.MouseEvent;
private function closeHandler(evt:DropdownEvent):void {
myLabel.text = ComboBox(evt.target).selectedItem.labeltext;
private function loadLayerName():void
myLegend.layers = null;
layerPanel.removeAllChildren();
//loop through each layer and add as a radiobutton
for(var i:uint = 0; i < (dynamicLayer.layerInfos.length); i++)
var radioBtn:RadioButton = new RadioButton;
radioBtn.groupName = "radioBtnGroup";
radioBtn.value = i;
radioBtn.label = dynamicLayer.layerInfos[i].name;
if (dynamicLayer.layerInfos[i].name == "Direct Impact (Million $)")
radioBtn.label = "Direct Impact";
else if (dynamicLayer.layerInfos[i].name == "Total Impact (Million $)")
{radioBtn.label = "Total Impact";
else if (dynamicLayer.layerInfos[i].name == "Total Impact (Jobs)")
{radioBtn.label = "Total Impact";
else if (dynamicLayer.layerInfos[i].name == "Direct Impact (Jobs)")
{radioBtn.label = "Direct Impact";
else
{radioBtn.visible= false;
layerPanel.addChild(radioBtn);
/* myDividerBox.getDividerAt(0).visible = false; */
//set the visible layer the first radio button
radioBtnGroup.selectedValue = 0;
dynamicLayer.visibleLayers = new ArrayCollection([0]);
myLegend.layers = [dynamicLayer];
myLegend.visible = true;
private function radioClickHandler(event:ItemClickEvent):void
myLegend.layers = null;
// update the visible layers to only show the layer selected
dynamicLayer.visibleLayers = new ArrayCollection([event.index]);
myLegend.layers = [dynamicLayer];
private function changeEvt(event:Event):void {
if (yearcombo.selectedItem.year == "2007")
measures.filterFunction=filter1
measures.refresh()
myURL.dataProvider=measures
else if (yearcombo.selectedItem.year == "2009")
measures.filterFunction=filter2
measures.refresh();
public function filter1(item:Object):Boolean
if (item.year=="2007") return true
else return false
public function filter2(item:Object):Boolean
if (item.year=="2009") return true
else return false
private function clickEvt(event:Event):void {
if (yearcombo.selectedItem.year == "2007")
measures.filterFunction=filter3
measures.refresh()
myURL.dataProvider=measures
else if (yearcombo.selectedItem.year == "2009")
measures.filterFunction=filter4
measures.refresh();
public function filter3(item:Object):Boolean
if (item.year=="2007") return true
else return false
public function filter4(item:Object):Boolean
if (item.year=="2009") return true
else return false
private function clickEv2(event:Event):void {
if (yearcombo.selectedItem.year == "2007")
measures.filterFunction=filter5
measures.refresh()
else if (yearcombo.selectedItem.year == "2009")
measures.filterFunction=filter6
measures.refresh();
else if (yearcombo.selectedItem.year == 2007 && myURL.selectedIndex==8)
myLegend.layers = null;
layerPanel.removeAllChildren();
public function filter5(item:Object):Boolean
if (item.year=="2007") return true
else return false
public function filter6(item:Object):Boolean
if (item.year=="2009") return true
else return false
/* IF YOU WANT TO INCLUDE OTHER VALUES IN THE MAP TOOLTIP LIKE COUNTY NAME AND THE LABEL OF THE SELECTED ITEM
if (myURL.selectedIndex==0)
myTextArea.htmlText = "<b>County: </b>" + gr.attributes.NAME + "\n"
+ "<b>Measure: </b>" + myURL.selectedItem.label + gr.attributes.ForDirIndOut.toString()
public function fLayer_graphicAddHandler(event:GraphicEvent):void
event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);
public function onMouseOverHandler(event:MouseEvent):void
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 3 )
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 3 )
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
public function onMouseOutHandler(event:MouseEvent):void
var gr:Graphic = Graphic(event.target);
gr.symbol = defaultsym;
myMap.infoWindow.hide();
]]>
</fx:Script>
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@namespace esri "http://www.esri.com/2008/ags";
@namespace components "com.esri.ags.components.*";
components|InfoWindow
content-background-alpha : 0.4;
background-color : #4A7138;
background-alpha : 0.7;
border-style : solid;
</fx:Style>
<mx:HBox width="930" height="800" id="mapHbox" horizontalAlign="center" >
<mx:HBox width="80">
</mx:HBox>
<mx:HBox id="myHBox" width="800" height="600" backgroundColor="0xffffff" >
<mx:VBox height="590" width="358" >
<!-- <mx:Panel
width="356" height="100%"
color="0x000000"
borderAlpha="0.15"
>
-->
<mx:Canvas height="100%" width="100%" backgroundColor="0xffffff" >
<esri:Map id="myMap" openHandCursorVisible="false"
height="100%"
logoVisible="false"
doubleClickZoomEnabled="false"
scrollWheelZoomEnabled="false"
zoomSliderVisible="false"
scaleBarVisible="false" scale="4000000" >
<esri:extent>
<esri:Extent xmin="-10736651.061900" ymin="4024099.909700" xmax="-10409195.669800" ymax="3440153.831100" >
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISDynamicMapServiceLayer id="dynamicLayer2"
url="http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/counties_layer/MapServer" />
<esri:ArcGISDynamicMapServiceLayer id="dynamicLayer" name=" "
alpha="1"
load="loadLayerName()"
url="http://tfs-24279/ArcGIS/rest/services/{myURL.selectedItem.value}/MapServer" />
<esri:FeatureLayer id="fLayer"
graphicAdd="fLayer_graphicAddHandler(event)"
mode="snapshot"
outFields="*"
symbol="{defaultsym}"
url= "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/feature_layer_0709_five/FeatureServer/ 0" />
</esri:Map>
</mx:Canvas>
<!-- </mx:Panel>-->
</mx:VBox>
<mx:VBox height="590" width="20" >
</mx:VBox>
<mx:Canvas height="500" width="400" backgroundColor="0xffffff"
horizontalScrollPolicy="off"
verticalScrollPolicy="off" >
<mx:VBox width="420" height="50%" paddingLeft="5" paddingTop="10" paddingRight="10" paddingBottom="10"
verticalGap="8">
<mx:Form >
<mx:FormItem label="Year :" >
<mx:ComboBox id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)" >
<mx:ArrayCollection id="year" >
<fx:Object label="2007" year="2007" />
<fx:Object label="2009" year="2009" />
</mx:ArrayCollection>
</mx:ComboBox>
</mx:FormItem>
<mx:FormItem label="Measure:">
<mx:ComboBox id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
<mx:ArrayCollection id="measures" >
<fx:Object id="forindout07" labeltext="Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007" />
<fx:Object id="foremp07" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
<fx:Object id="forlabinc07" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
<fx:Object id="forindbustax07" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
<fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009" />
<fx:Object id="foremp09" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
<fx:Object id="forlabinc09" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
<fx:Object id="forindbustax09" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
<fx:Object id="blank" label=" " />
</mx:ArrayCollection>
</mx:ComboBox>
</mx:FormItem>
</mx:Form>
<mx:VBox id="layerPanel" width="50%" height="8%" verticalGap="3" paddingLeft="17">
<mx:RadioButtonGroup id="radioBtnGroup" itemClick="radioClickHandler(event)" />
</mx:VBox>
<mx:VBox paddingLeft="17" height="50%" >
<mx:Canvas id="legendPanel" width="100%" >
<mx:Label id="myLabel" text=" " fontWeight="bold" />
<esri:Legend id="myLegend"
layers="{[dynamicLayer]}"
map="{myMap}" visible="false"
respectCurrentMapScale="false"/>
</mx:Canvas>
<mx:TextArea width="275" borderAlpha="0" height="200" >
<mx:htmlText >
<![CDATA[<font size='11'><b>Note:</b> Counties in white indicate either no data is available for that measure or the data has been supressed due to confidentiality.</font>
]]>
</mx:htmlText>
</mx:TextArea>
</mx:VBox>
</mx:VBox>
</mx:Canvas>
</mx:HBox>
</mx:HBox>
</mx:Application> -
Problem with PDF export and embedded font (characters disappear)
Designer: Crystal Reports 2008 SP 2
Engine: CR4E 2.0 SP2 (runtime_12.2.203)
Hi there!
we found a problem in the pdf export. It seems like there would be a problem with the embedded fonts, the problem is as follows:
Rpt file with, for example only a text box which contains the german string " Änderungs Schlüssel ".
Export the Rpt file with CR4E to a pdf file.
When we open the pdf file in Adope Reader 8, the text appears to be correct,
but if we print the PDF file from the Adope Reader, the text changes to " nderungs Schl sselu201C,
here we are missing ther german umlaute.
When we open the file for example with an alternative PDF reader like Foxit Reader, there they are also missing.
After i found some posts here in the forum, there are people facing the same problem, since i couldn't find a solution in the forum, we build a little workaround for it that works for us.
For all of you that have the same problem here the workaround:
We used the IText JAVA library, this jar can can help as to fix the PDF file so the text is displayed correctly.
Here the code:
ReportClientDocument doc = new ReportClientDocument();
doc.setReportAppServer(ReportClientDocument.inprocConnectionString);
doc.open("C:\XY.rpt", OpenReportOptions._openAsReadOnly);
//... database logon,.....
InputStream inputStream = doc.getPrintOutputController().export(ReportExportFormat.PDF);
inputStream = PDFHealer.heal(inputStream);
//... write the stream some whereThe helper class using IText:
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfImportedPage;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfWriter;
public class PDFHealer
public static InputStream heal(InputStream in) throws DocumentException, IOException
try
ByteArrayOutputStream out = new ByteArrayOutputStream();
PdfReader reader = new PdfReader(in);
// we retrieve the total number of pages
int n = reader.getNumberOfPages();
// step 1: creation of a document-object
Document document = new Document();
// step 2: we create a writer that listens to the document
PdfWriter writer = PdfWriter.getInstance(document, out);
// step 3: we open the document
document.open();
// step 4: we add content
PdfContentByte cb = writer.getDirectContent();
int i = 0;
while( i < n )
document.newPage();
i++;
PdfImportedPage page1 = writer.getImportedPage(reader, i);
cb.addTemplate(page1, 0, 0);
// step 5: we close the document
document.close();
ByteArrayInputStream ret = new ByteArrayInputStream(out.toByteArray());
out.close();
return ret;
finally
in.close(); -
Problem in refreshing the combo box on selection of an item in another comb
I have a situation where values to be displayed in 2nd combo box depends on the selection of an item from the 1st combo box.
Problem observed:
The 2nd combo box is not getting refreshed if the selected item from the 1st combo box has mapping to more than 10 items.
for ex:
A - AA, AB, AC, AD, AE, AF
B - BA, BB, BC, BD, BE, BF, BG, BH, BI, BJ, BK, BL, BM, BN, BO, BP
C - CA, CB, CC
D - DA, DB, DC, DD
1st combo box list:
A
B
C
D
2nd combo box list:
If the value selected from the first combo box is A, C, or D then 2nd combo box refreshes with repective values. But when the value selected is B, then 2nd combo box is not getting refreshed with respective values.
Combo Model for 1st combo box:
public class proCLMLossTypeComboModel implements javax.swing.ComboBoxModel
package nz.co.towerinsurance.quantum.claims.pro;
import javax.swing.*;
import java.util.*;
import CoreProduct.mbsoPRDLossCauseTypeList;
import javax.swing.event.*;
public class proCLMLossTypeComboModel implements javax.swing.ComboBoxModel
Vector vector = null;
mbsoPRDLossCauseTypeList mbsoPRDLossCauseTypeListInst0 = null;
public void setData(Vector vector)
this.vector = vector;
public int getSize()
if(vector != null)
return this.vector.size();
else
return 0;
public void addListDataListener(ListDataListener l)
public void removeListDataListener(ListDataListener l)
public Object getElementAt(int index)
return this.vector.elementAt(index);
public Object getSelectedItem()
return this.mbsoPRDLossCauseTypeListInst0;
public void setSelectedItem(Object anItem)
mbsoPRDLossCauseTypeList mbsoPRDLossCauseTypeListInst1 = (mbsoPRDLossCauseTypeList)anItem;
this.mbsoPRDLossCauseTypeListInst0 = mbsoPRDLossCauseTypeListInst1;
public Vector getData()
return this.vector;
Combo Model for 2nd combo box:
package nz.co.towerinsurance.quantum.claims.pro;
import javax.swing.*;
import java.util.*;
import CoreProduct.mbsoPRDCauseTypeList;
import javax.swing.event.*;
public class proCLMCauseTypeComboModel implements javax.swing.ComboBoxModel
Vector vector = null;
mbsoPRDCauseTypeList mbsoPRDCauseTypeListInst0 = null;
public void setData(Vector vector)
this.vector = vector;
public int getSize()
if(vector != null)
return this.vector.size();
else
return 0;
public void addListDataListener(ListDataListener l)
public void removeListDataListener(ListDataListener l)
public Object getElementAt(int index)
return this.vector.elementAt(index);
public Object getSelectedItem()
return this.mbsoPRDCauseTypeListInst0;
public void setSelectedItem(Object anItem)
mbsoPRDCauseTypeList mbsoPRDCauseTypeListInst1 = (mbsoPRDCauseTypeList)anItem;
this.mbsoPRDCauseTypeListInst0 = mbsoPRDCauseTypeListInst1;
public Vector getData()
return this.vector;
The Panel inside which these combo boxes are used:
package nz.co.towerinsurance.quantum.claims.pro;
import nz.co.towerinsurance.quantum.logger.MessageLogger;
import nz.co.towerinsurance.quantum.claims.vmo.*;
import nz.co.towerinsurance.quantum.utility.uhoUTLDialogueContext;
import nz.co.towerinsurance.quantum.utility.uhoUTLModelHolder;
import nz.co.towerinsurance.quantum.utility.uhoUTLInteraction;
import nz.co.towerinsurance.quantum.utility.uhoUTLNotesContext;
import nz.co.towerinsurance.quantum.utility.uhoUTLPrivacyContext;
import nz.co.towerinsurance.quantum.utility.uhoUTLProcessImpContext;
import nz.co.towerinsurance.quantum.help.*;
import nz.co.towerinsurance.quantum.document.*;
import nz.co.towerinsurance.quantum.task.*;
import nz.co.towerinsurance.quantum.qtm.*;
import nz.co.towerinsurance.quantum.claims.uhoCLMClientModel;
import nz.co.towerinsurance.quantum.claims.utility.*;
import MCType.*;
import Claim.*;
import Client.*;
import Policy.*;
import CoreProduct.*;
import Security.*;
import MCUtil.*;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import javax.swing.ButtonGroup.*;
import java.text.*;
public class proSummaryPanel extends proCLMPanelBase implements proCLMRefreshInterface, proCLMDeclineReasonInterface
private static final MessageLogger msgLogger=MessageLogger.getLogger("claims.pro.proSummaryPanel");
uhoCLMClientModel uhoCLMClientModelInst0 = null;
Vector VectorInst0 = new Vector();
JRadioButton jRdBtnSummaryPM = new JRadioButton();
JRadioButton jRdBtnSummaryAM = new JRadioButton();
ButtonGroup ButtonGroupInst0 = new ButtonGroup();
JButton jBtnSummarySearch = new JButton();
JLabel jLblSummaryCompanyName = new JLabel();
JLabel jLblSummaryCauseType = new JLabel();
JTextField jTxtFldSummaryAmountSaved = new JTextField();
JTextField jTxtFldSummaryDateNotified = new JTextField();
JTextField jTxtFldSummary = new JTextField();
JTextField jTxtFldSummarySuburb = new JTextField();
JLabel jLblSummaryCatCode = new JLabel();
JLabel jLblSummaryLossDesc = new JLabel();
JLabel jLblSummaryDateNotified = new JLabel();
JLabel jLblSummaryCity = new JLabel();
JLabel jLblSummaryTime = new JLabel();
JLabel jLblSummaryDeclineReason = new JLabel();
JCheckBox jChkBxNcbLost = new JCheckBox();
JCheckBox jChkBxLegal = new JCheckBox();
JCheckBox jChkBxNoBlameBonus = new JCheckBox();
JLabel jLblSummaryPostCode = new JLabel();
JTextField jTxtFldSummaryStreetName = new JTextField();
JTextField jTxtFldSummaryLossDate = new JTextField();
JTextField jTxtFldSummaryCity = new JTextField();
JTextField jTxtFldSummaryTime = new JTextField();
JLabel jLblSummaryLossType = new JLabel();
JTextField jTxtFldSummaryPhone = new JTextField();
JTextField jTxtFldSummaryCompanyName = new JTextField();
JLabel jLblSummarySuburb = new JLabel();
JTextArea jTxtArLossDescription = new JTextArea();
JScrollPane jScrPnSummaryLossDesc = new JScrollPane(jTxtArLossDescription);
JTextField jTxtFldSummaryDeclineReason = new JTextField();
JPanel jPanel2 = new JPanel();
JPanel jPanel1 = this;
JLabel jLblSummaryPhone = new JLabel();
JTextField jTxtFldSummaryPostCode = new JTextField();
JLabel jLblSummaryAmountSaved = new JLabel();
JPanel jPnlSummaryCoy = new JPanel();
JLabel jLblSummaryStreetName = new JLabel();
Vector lossTypeVec = new Vector();
JComboBox jCmbBxSummaryLossType = new JComboBox(lossTypeVec);
proCLMLossTypeComboModel lossTypeComboModel = new proCLMLossTypeComboModel();
Vector causeTypeVec = new Vector();
JComboBox jCmbBxSummaryCauseType = new JComboBox();
proCLMCauseTypeComboModel causeTypeComboModel = new proCLMCauseTypeComboModel();
Vector CatCodeVec = new Vector();
JComboBox jCmbBxSummaryCatCode = new JComboBox();
proCLMCatCodeComboModel catCodeComboModel = new proCLMCatCodeComboModel();
JLabel jLblSummaryLossDate = new JLabel();
JButton jBtnSave = new JButton();
JButton jBtnCancel = new JButton();
Border border1;
TitledBorder titledBorder1;
Border border2;
Border border3;
TitledBorder titledBorder2;
Border border4;
TitledBorder titledBorder3;
GridBagLayout gridBagLayout1 = new GridBagLayout();
GridBagLayout gridBagLayout2 = new GridBagLayout();
Border border5;
TitledBorder titledBorder4;
GridBagLayout gridBagLayout3 = new GridBagLayout();
GridBagLayout gridBagLayout4 = new GridBagLayout();
Component component1;
Component component2;
* @parameter uhoUTLInteraction ,mbsoSEMPrivilege
* @return
public proSummaryPanel(proQTMBase parent, uhoUTLInteraction inter,mbsoSEMPrivilege services)
super(parent,inter,services);
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
* Component initialization
* @parameter
* @return void
private void jbInit() throws Exception
component1 = Box.createHorizontalStrut(8);
component2 = Box.createHorizontalStrut(8);
jCmbBxSummaryLossType.setMinimumSize(new Dimension(225, 25));
// set the combo models
jCmbBxSummaryLossType.setModel(lossTypeComboModel);
jCmbBxSummaryCauseType.setModel(causeTypeComboModel);
jCmbBxSummaryCatCode.setModel(catCodeComboModel);
// renderer for the loss type combo
jCmbBxSummaryLossType.setRenderer(new DefaultListCellRenderer()
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus)
mbsoPRDLossCauseTypeList mbsoPRDLossTypeListObj = (mbsoPRDLossCauseTypeList) value;
String v = (mbsoPRDLossTypeListObj == null) ? null:mbsoPRDLossTypeListObj.GetLossTypeName().toString();
return super.getListCellRendererComponent(list,v,index,isSelected,cellHasFocus);
// key selection manager for loss type combo
jCmbBxSummaryLossType.setKeySelectionManager(new javax.swing.JComboBox.KeySelectionManager()
public int selectionForKey(char aKey,ComboBoxModel aModel)
try
Vector vector = lossTypeComboModel.getData();
// prepare a character array witht the first letter of loss types in lower case
char[] characterArray = new char[vector.size()];
for(int i=0;i<vector.size();i++)
mbsoPRDLossCauseTypeList mbsoPRDLossCauseTypeListInst0 = (mbsoPRDLossCauseTypeList)vector.elementAt(i);
char charac = mbsoPRDLossCauseTypeListInst0.GetLossTypeName().toString().toLowerCase().charAt(0);
characterArray[i] = charac;
Character char1 = new Character(aKey);
int index = 0;
if(char1.isUpperCase(aKey))
char char2 = char1.toLowerCase(aKey);
index = java.util.Arrays.binarySearch(characterArray,char2);
else
index = java.util.Arrays.binarySearch(characterArray,aKey);
if(index > 0)
jCmbBxSummaryLossType.setSelectedIndex(index);
else
jCmbBxSummaryLossType.setSelectedIndex(0);
jCmbBxSummaryLossType.repaint();
if(index > 0)
return index;
else
return 0;
catch(Exception e1)
msgLogger.fatal("Exception : proSumamryPanel : loss type combo key sel mgr : "+e1.getMessage());
return 0;
// renderer for cause type combo
jCmbBxSummaryCauseType.setRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus)
mbsoPRDCauseTypeList mbsoPRDCauseTypeListObj = (mbsoPRDCauseTypeList) value;
String v = (mbsoPRDCauseTypeListObj == null) ? null:mbsoPRDCauseTypeListObj.GetCauseTypeName().toString();
return super.getListCellRendererComponent(list,v,index,isSelected,cellHasFocus);
// key selection manager for loss type combo
jCmbBxSummaryCauseType.setKeySelectionManager(new javax.swing.JComboBox.KeySelectionManager()
public int selectionForKey(char aKey,ComboBoxModel aModel)
try
Vector vector = causeTypeComboModel.getData();
// prepare a character array witht the first letter of loss types in lower case
char[] characterArray = new char[vector.size()];
for(int i=0;i<vector.size();i++)
mbsoPRDCauseTypeList mbsoPRDCauseTypeListInst0 = (mbsoPRDCauseTypeList)vector.elementAt(i);
char charac = mbsoPRDCauseTypeListInst0.GetCauseTypeName().toString().toLowerCase().charAt(0);
characterArray[i] = charac;
Character char1 = new Character(aKey);
int index = 0;
if(char1.isUpperCase(aKey))
char char2 = char1.toLowerCase(aKey);
index = java.util.Arrays.binarySearch(characterArray,char2);
else
index = java.util.Arrays.binarySearch(characterArray,aKey);
if(index > 0)
jCmbBxSummaryCauseType.setSelectedIndex(index);
else
jCmbBxSummaryCauseType.setSelectedIndex(0);
jCmbBxSummaryCauseType.repaint();
if(index > 0)
return index;
else
return 0;
catch(Exception e1)
msgLogger.fatal("Exception : proSumamryPanel : cause type combo key sel mgr : "+e1.getMessage());
return 0;
jBtnSummarySearch.setBorder(BorderFactory.createRaisedBevelBorder());
jBtnSummarySearch.setMaximumSize(new Dimension(119, 23));
jBtnSummarySearch.setPreferredSize(new Dimension(65, 23));
jBtnSummarySearch.setMnemonic(KeyEvent.VK_E); // 20/12
jBtnSummarySearch.setText("Search");
this.setLayout(gridBagLayout4);
ButtonGroupInst0.add(jRdBtnSummaryPM);
ButtonGroupInst0.add(jRdBtnSummaryAM);
border1 = BorderFactory.createEtchedBorder(Color.white,new Color(142, 142, 142));
titledBorder1 = new TitledBorder(border1,"Where Is It Now?");
border2 = BorderFactory.createEtchedBorder(Color.white,new Color(142, 142, 142));
border3 = BorderFactory.createEtchedBorder(Color.white,new Color(142, 142, 142));
titledBorder2 = new TitledBorder(border3,"Where Is It Now?");
border4 = BorderFactory.createEtchedBorder(Color.white,new Color(142, 142, 142));
titledBorder3 = new TitledBorder(border4,"Summary");
border5 = BorderFactory.createEtchedBorder(Color.white,new Color(142, 142, 142));
titledBorder4 = new TitledBorder(border5,"Location of Vehicle/Boat");
jScrPnSummaryLossDesc.setToolTipText("");
jScrPnSummaryLossDesc.setFont(new java.awt.Font("SansSerif", 0, 12));
jScrPnSummaryLossDesc.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
jLblSummarySuburb.setText("Suburb");
jLblSummarySuburb.setForeground(Color.black);
jLblSummarySuburb.setPreferredSize(new Dimension(100, 17));
jLblSummarySuburb.setFont(new java.awt.Font("SansSerif", 1, 12));
jTxtFldSummaryCompanyName.setFont(new java.awt.Font("SansSerif", 0, 12));
jTxtFldSummaryCompanyName.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummaryCompanyName.setMinimumSize(new Dimension(100, 20));
jTxtFldSummaryCompanyName.setPreferredSize(new Dimension(100, 20));
jTxtFldSummaryPhone.setToolTipText("");
jTxtFldSummaryPhone.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummaryPhone.setMinimumSize(new Dimension(100, 20));
jTxtFldSummaryPhone.setPreferredSize(new Dimension(100, 20));
jTxtFldSummaryPhone.setFont(new java.awt.Font("SansSerif", 0, 12));
jLblSummaryLossType.setText("Loss Type");
jLblSummaryLossType.setForeground(Color.black);
jLblSummaryLossType.setPreferredSize(new Dimension(102, 17));
jLblSummaryLossType.setFont(new java.awt.Font("SansSerif", 1, 12));
jTxtFldSummaryTime.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummaryTime.setMinimumSize(new Dimension(100, 20));
jTxtFldSummaryTime.setPreferredSize(new Dimension(100, 20));
jTxtFldSummaryTime.setFont(new java.awt.Font("SansSerif", 0, 12));
jTxtFldSummaryCity.setFont(new java.awt.Font("SansSerif", 0, 12));
jTxtFldSummaryCity.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummaryCity.setMinimumSize(new Dimension(100, 20));
jTxtFldSummaryCity.setPreferredSize(new Dimension(100, 20));
jTxtFldSummaryLossDate.setBackground(Color.cyan);
jTxtFldSummaryLossDate.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummaryLossDate.setMinimumSize(new Dimension(100, 20));
jTxtFldSummaryLossDate.setPreferredSize(new Dimension(100, 20));
jTxtFldSummaryLossDate.setFont(new java.awt.Font("SansSerif", 0, 12));
jBtnSave.setToolTipText("");
jBtnSave.setBorder(BorderFactory.createRaisedBevelBorder());
jBtnSave.setMnemonic('S');
jBtnSave.setText("Save");
jBtnSave.setPreferredSize(new Dimension(100,23)); // 30/07
jBtnSummarySearch.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(ActionEvent e) {
jBtnSummarySearch_actionPerformed(e);
//the listener for losstype combobox
jCmbBxSummaryLossType.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(ItemEvent e) {
jCmbBxSummaryLossType_itemStateChanged(e);
//Actioin listener for Save button
jBtnSave.addActionListener(new java.awt.event.ActionListener()
public void actionPerformed(ActionEvent e)
jBtnSave_actionPerformed(e);
//Actioin listener for Cancel button
jTxtFldSummaryStreetName.setFont(new java.awt.Font("SansSerif", 0, 12));
jTxtFldSummaryStreetName.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummaryStreetName.setMinimumSize(new Dimension(100, 20));
jTxtFldSummaryStreetName.setPreferredSize(new Dimension(100, 20));
jLblSummaryPostCode.setText("Post Code");
jLblSummaryPostCode.setForeground(Color.black);
jLblSummaryPostCode.setPreferredSize(new Dimension(100, 17));
jLblSummaryPostCode.setFont(new java.awt.Font("SansSerif", 1, 12));
jChkBxNcbLost.setFont(new java.awt.Font("SansSerif", 1, 12));
jChkBxNcbLost.setPreferredSize(new Dimension(130, 17));
jChkBxNcbLost.setText("NCB Lost");
jLblSummaryDeclineReason.setText("Decline Reason");
jLblSummaryDeclineReason.setForeground(Color.black);
jLblSummaryDeclineReason.setPreferredSize(new Dimension(102, 17));
jLblSummaryDeclineReason.setFont(new java.awt.Font("SansSerif", 1, 12));
jLblSummaryTime.setText("Time");
jLblSummaryTime.setForeground(Color.black);
jLblSummaryTime.setPreferredSize(new Dimension(35, 17));
jLblSummaryTime.setFont(new java.awt.Font("SansSerif", 1, 12));
jLblSummaryCity.setText("Town/City");
jLblSummaryCity.setForeground(Color.black);
jLblSummaryCity.setPreferredSize(new Dimension(100, 17));
jLblSummaryCity.setFont(new java.awt.Font("SansSerif", 1, 12));
jLblSummaryDateNotified.setText("Date Notified");
jLblSummaryDateNotified.setForeground(Color.black);
jLblSummaryDateNotified.setPreferredSize(new Dimension(102, 17));
jLblSummaryDateNotified.setFont(new java.awt.Font("SansSerif", 1, 12));
jLblSummaryLossDesc.setText("Loss Description");
jLblSummaryLossDesc.setForeground(Color.black);
jLblSummaryLossDesc.setPreferredSize(new Dimension(102, 17));
jLblSummaryLossDesc.setFont(new java.awt.Font("SansSerif", 1, 12));
jLblSummaryCatCode.setText("Catastrophe Code");
jLblSummaryCatCode.setForeground(Color.black);
jLblSummaryCatCode.setFont(new java.awt.Font("SansSerif", 1, 12));
jTxtFldSummarySuburb.setFont(new java.awt.Font("SansSerif", 0, 12));
jTxtFldSummarySuburb.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummarySuburb.setMinimumSize(new Dimension(100, 20));
jTxtFldSummarySuburb.setPreferredSize(new Dimension(100, 20));
jTxtFldSummaryAmountSaved.setFont(new java.awt.Font("SansSerif", 0, 12));
jTxtFldSummaryAmountSaved.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummaryAmountSaved.setMinimumSize(new Dimension(100, 20));
jTxtFldSummaryAmountSaved.setPreferredSize(new Dimension(100, 20));
jTxtFldSummaryDateNotified.setFont(new java.awt.Font("SansSerif", 0, 12));
jTxtFldSummaryDateNotified.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummaryDateNotified.setMinimumSize(new Dimension(100, 20));
jTxtFldSummaryDateNotified.setPreferredSize(new Dimension(100, 20));
jLblSummaryCauseType.setText("Cause Type");
jLblSummaryCauseType.setForeground(Color.black);
jLblSummaryCauseType.setPreferredSize(new Dimension(102, 17));
jLblSummaryCauseType.setFont(new java.awt.Font("SansSerif", 1, 12));
jLblSummaryCompanyName.setText("Company Name");
jLblSummaryCompanyName.setForeground(Color.black);
jLblSummaryCompanyName.setPreferredSize(new Dimension(100, 17));
jLblSummaryCompanyName.setFont(new java.awt.Font("SansSerif", 1, 12));
jCmbBxSummaryCatCode.setFont(new java.awt.Font("SansSerif", 0, 12));
jCmbBxSummaryCatCode.setMinimumSize(new Dimension(225, 25)); // on 21/11
jCmbBxSummaryCatCode.setPreferredSize(new Dimension(126, 25));
jRdBtnSummaryPM.setFont(new java.awt.Font("SansSerif", 1, 12));
jRdBtnSummaryPM.setPreferredSize(new Dimension(40, 17));
jRdBtnSummaryPM.setText("pm");
jTxtFldSummaryDeclineReason.setFont(new java.awt.Font("SansSerif", 0, 12));
jTxtFldSummaryDeclineReason.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummaryDeclineReason.setMinimumSize(new Dimension(225, 20));
jTxtFldSummaryDeclineReason.setPreferredSize(new Dimension(225, 20));
jChkBxLegal.setPreferredSize(new Dimension(130, 17));
jChkBxLegal.setText("Legal");
jChkBxLegal.setActionCommand("jChkBxLegal");
jChkBxLegal.setFont(new java.awt.Font("SansSerif", 1, 12));
jPanel2.setBorder(BorderFactory.createEtchedBorder());
jPanel2.setLayout(gridBagLayout1);
jPanel1.setLayout(gridBagLayout3);
jLblSummaryPhone.setFont(new java.awt.Font("SansSerif", 1, 12));
jLblSummaryPhone.setForeground(Color.black);
jLblSummaryPhone.setPreferredSize(new Dimension(100, 17));
jLblSummaryPhone.setText("Phone");
jRdBtnSummaryAM.setPreferredSize(new Dimension(40, 17));
jRdBtnSummaryAM.setText("am");
jRdBtnSummaryAM.setFont(new java.awt.Font("SansSerif", 1, 12));
jRdBtnSummaryAM.setSelected(true); // 20/12
jTxtFldSummaryPostCode.setBorder(BorderFactory.createLoweredBevelBorder());
jTxtFldSummaryPostCode.setMinimumSize(new Dimension(100, 20));
jTxtFldSummaryPostCode.setPreferredSize(new Dimension(100, 20));
jTxtFldSummaryPostCode.setFont(new java.awt.Font("SansSerif", 0, 12));
jLblSummaryAmountSaved.setText("Amount Saved");
jLblSummaryAmountSaved.setForeground(Color.black);
jLblSummaryAmountSaved.setPreferredSize(new Dimension(102, 17));
jLblSummaryAmountSaved.setFont(new java.awt.Font("SansSerif", 1, 12));
jPnlSummaryCoy.setFont(new java.awt.Font("SansSerif", 1, 12));
jPnlSummaryCoy.setBorder(titledBorder4);
jPnlSummaryCoy.setLayout(gridBagLayout2);
jLblSummaryStreetName.setFont(new java.awt.Font("SansSerif", 1, 12));
jLblSummaryStreetName.setForeground(Color.black);
jLblSummaryStreetName.setPreferredSize(new Dimension(100, 17));
jLblSummaryStreetName.setText("Street Name");
jCmbBxSummaryLossType.setBackground(Color.cyan);
jCmbBxSummaryLossType.setFont(new java.awt.Font("SansSerif", 0, 12));
jCmbBxSummaryLossType.setPreferredSize(new Dimension(225, 26));
jCmbBxSummaryCauseType.setBackground(Color.cyan);
jCmbBxSummaryCauseType.setFont(new java.awt.Font("SansSerif", 0, 12));
jCmbBxSummaryCauseType.setPreferredSize(new Dimension(225, 26));
jLblSummaryLossDate.setText("Loss Date");
jLblSummaryLossDate.setForeground(Color.black);
jLblSummaryLossDate.setPreferredSize(new Dimension(102, 17));
jLblSummaryLossDate.setFont(new java.awt.Font("SansSerif", 1, 12));
jTxtArLossDescription.setLineWrap(true);
jTxtArLossDescription.setWrapStyleWord(true);
jTxtArLossDescription.setBackground(Color.cyan);
jTxtArLossDescription.setFont(new java.awt.Font("SansSerif", 0, 12));
jTxtArLossDescription.setBounds(new Rectangle(124, 39, 394, 46));
jChkBxNoBlameBonus.setPreferredSize(new Dimension(130, 17));
jChkBxNoBlameBonus.setText("No Blame Bonus ");
jChkBxNoBlameBonus.setFont(new java.awt.Font("SansSerif", 1, 12));
jPanel1.setBorder(titledBorder3);
jPanel1.setBounds(new Rectangle(23, 11, 810, 436));
jPanel1.add(jLblSummaryCatCode, new GridBagConstraints(0, 6, 1, 1, 0.1, 0.05
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jScrPnSummaryLossDesc, new GridBagConstraints(1, 1, 6, 1, 0.9, 0.15
,GridBagConstraints.SOUTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
jScrPnSummaryLossDesc.getViewport().add(jTxtArLossDescription, null);
jPanel1.add(jRdBtnSummaryPM, new GridBagConstraints(5, 0, 1, 1, 0.1, 0.05
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jTxtFldSummaryDeclineReason, new GridBagConstraints(1, 8, 2, 1, 0.1, 0.1
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLblSummaryLossDesc, new GridBagConstraints(0, 1, 1, 1, 0.1, 0.5
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLblSummaryLossType, new GridBagConstraints(0, 3, 1, 1, 0.1, 0.05
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLblSummaryCauseType, new GridBagConstraints(0, 4, 1, 1, 0.1, 0.05
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLblSummaryDeclineReason, new GridBagConstraints(0, 8, 1, 1, 0.1, 0.05
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLblSummaryLossDate, new GridBagConstraints(0, 0, 1, 1, 0.1, 0.05
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jTxtFldSummaryTime, new GridBagConstraints(3, 0, 1, 1, 0.1, 0.05
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLblSummaryTime, new GridBagConstraints(3, 0, 1, 1, 0.1, 0.05
,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 107, 7));
jPanel1.add(jRdBtnSummaryAM, new GridBagConstraints(4, 0, 1, 1, 0.1, 0.05
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jCmbBxSummaryCauseType, new GridBagConstraints(1, 4, 2, 1, 0.1, 0.05
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jTxtFldSummaryLossDate, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.05
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jTxtFldSummaryDateNotified, new GridBagConstraints(1, 7, 1, 1, 0.1, 0.05
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jPanel2, new GridBagConstraints(0, 9, 6, 1, 1.0, 0.1
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
jPanel2.add(jChkBxNoBlameBonus, new GridBagConstraints(3, 0, 1, 1, 0.1, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel2.add(jChkBxLegal, new GridBagConstraints(4, 0, 1, 1, 0.1, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel2.add(jBtnSave, new GridBagConstraints(5, 0, 1, 1, 0.1, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel2.add(jChkBxNcbLost, new GridBagConstraints(2, 0, 1, 1, 0.1, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel2.add(component1, new GridBagConstraints(1, 0, 1, 1, 0.35, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel2.add(component2, new GridBagConstraints(5, 0, 1, 1, 0.35, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jCmbBxSummaryLossType, new GridBagConstraints(1, 3, 2, 1, 0.1, 0.05
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jCmbBxSummaryCatCode, new GridBagConstraints(1, 6, 2, 1, 0.1, 0.05
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jPnlSummaryCoy, new GridBagConstraints(2, 3, 4, 6, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jLblSummaryPhone, new GridBagConstraints(0, 6, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jLblSummarySuburb, new GridBagConstraints(0, 3, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jTxtFldSummaryStreetName, new GridBagConstraints(1, 2, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jTxtFldSummaryCity, new GridBagConstraints(1, 4, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jTxtFldSummaryPostCode, new GridBagConstraints(1, 5, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jTxtFldSummarySuburb, new GridBagConstraints(1, 3, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jLblSummaryPostCode, new GridBagConstraints(0, 5, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jTxtFldSummaryPhone, new GridBagConstraints(1, 6, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jTxtFldSummaryCompanyName, new GridBagConstraints(1, 0, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jLblSummaryCompanyName, new GridBagConstraints(0, 0, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jLblSummaryStreetName, new GridBagConstraints(0, 2, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPnlSummaryCoy.add(jLblSummaryCity, new GridBagConstraints(0, 4, 1, 1, 0.5, 0.16
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLblSummaryDateNotified, new GridBagConstraints(0, 7, 1, 1, 0.1, 0.05
,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jBtnSummarySearch, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jTxtFldSummaryLossDate.grabFocus();
jTxtFldSummaryLossDate.setNextFocusableComponent(jTxtFldSummaryTime);
jTxtFldSummaryTime.setNextFocusableComponent(jRdBtnSummaryAM);
jRdBtnSummaryAM.setNextFocusableComponent(jRdBtnSummaryPM);
jRdBtnSummaryPM.setNextFocusableComponent(jTxtArLossDescription);
jTxtArLossDescription.setNextFocusableComponent(jCmbBxSummaryLossType);
jCmbBxSummaryLossType.setNextFocusableComponent(jCmbBxSummaryCauseType);
jCmbBxSummaryCauseType.setNextFocusableComponent(jBtnSummarySearch);
jBtnSummarySearch.setNextFocusableComponent(jCmbBxSummaryCatCode);
jCmbBxSummaryCatCode.setNextFocusableComponent(jTxtFldSummaryDateNotified);
jTxtFldSummaryDateNotified.setNextFocusableComponent(jTxtFldSummaryDeclineReason);
jTxtFldSummaryDeclineReason.setNextFocusableComponent(jTxtFldSummaryCompanyName);
jTxtFldSummaryCompanyName.setNextFocusableComponent(jTxtFldSummaryStreetName);
jTxtFldSummaryStreetName.setNextFocusableComponent(jTxtFldSummarySuburb);
jTxtFldSummarySuburb.setNextFocusableComponent(jTxtFldSummaryCity);
jTxtFldSummaryCity.setNextFocusableComponent(jTxtFldSummaryPostCode);
jTxtFldSummaryPostCode.setNextFocusableComponent(jTxtFldSummaryPhone);
jTxtFldSummaryPhone.setNextFocusableComponent(jChkBxNcbLost);
jChkBxNcbLost.setNextFocusableComponent(jChkBxNoBlameBonus);
jChkBxNoBlameBonus.setNextFocusableComponent(jChkBxLegal);
jChkBxLegal.setNextFocusableComponent(jBtnSave);
jBtnSave.setNextFocusabl &nbsthe very simple strategy to do is to call removeAllItems() method for the 2nd combox box and then insert the contents. this is because the validate() method is not repeatedly called and so the contents are not updated immediately.
-
How to populate the second combo box by depending on the selection in 1st?
I have two combo boxes, both of data in the lists come from the database. The list in the second will be changed when the selection is changed in the first one. I am trying to do query again in the ActionPerform function, unfortunately the list in second one doesn't change.
I am learning Swing now, I really appreciate for any suggestions!
Thankscamickr,
I have another question for the tab pane. Now I have to remove the tab and add tab for updating the tab pane. I wonder if there is other way to do it. I really appreciate your help!
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
public class test_tabpane extends JPanel implements ActionListener {
private JPanel MainPane;
private JComboBox combobox2;
private JTabbedPane TabbedPane;
private JComponent panel1;
private JComponent panel2;
private String [] resources ={"ZZAA", "ZZAB", "ZZAC", "ZZAD"};
private String selected_resource = "";
public test_tabpane() {
MainPane = new JPanel();
MainPane.setOpaque(true);
MainPane.setPreferredSize(new Dimension(600, 70));
MainPane.setBorder(BorderFactory.createRaisedBevelBorder());
combobox2 = new JComboBox(resources);
combobox2.addActionListener(this);
MainPane.add(combobox2);
add(MainPane);
UIManager.put("TabbedPane.tabInsets", new Insets(5,5,5,5));
TabbedPane = new JTabbedPane();
panel1 = makeTextPanel(resources[0]);
TabbedPane.addTab("Language/Notes", panel1);
panel2= makeTextPanel(resources[0]);
TabbedPane.addTab("Relations/Coverage", panel2);
TabbedPane.setPreferredSize(new Dimension(600, 340));
TabbedPane.setFont(new Font("ariel", Font.BOLD, 11));
TabbedPane.setSize(600, 340);
add(TabbedPane);
protected JComponent makeTextPanel(String text) {
JPanel panel = new JPanel(false);
JLabel filler = new JLabel(text);
filler.setHorizontalAlignment(JLabel.CENTER);
// panel.setLayout(new GridLayout(1, 1));
panel.add(filler);
return panel;
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox)e.getSource();
if ("comboBoxChanged".equals(e.getActionCommand()))
// if ("comboBoxEdited".equals(e.getActionCommand()))
// System.out.println("in action:" + (String)cb.getSelectedItem());
String selected_string = (String)cb.getSelectedItem();
StringTokenizer st = new StringTokenizer(selected_string, "|");
selected_resource = st.nextToken();
updateTabbedPanes(selected_resource);
protected void updateTabbedPanes(String selected_string) {
panel1 = makeTextPanel(selected_string + " in Language/Notes");
int index = TabbedPane.indexOfTab("Language/Notes");
TabbedPane.remove(index);
TabbedPane.insertTab("Language/Notes", null, panel1, "", index);
panel2 = makeTextPanel(selected_string + " in Relations/Coverage");
index = TabbedPane.indexOfTab("Relations/Coverage");
TabbedPane.remove(index);
TabbedPane.insertTab("Relations/Coverage", null, panel2, "", index);
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(false);
//Create and set up the window.
JFrame frame = new JFrame("test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
JComponent ContentPane = new test_tabpane();
ContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(ContentPane);
//centers a frame onscreen // it is a problem for wide screen
// frame.setLocationRelativeTo(null);
frame.setLocation(300, 120);
frame.setSize(1024, 768);
frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
//Display the window.
frame.pack();
frame.setVisible(true);
* @param args
* This is main function.
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
Maybe you are looking for
-
Reset Text Wrap and Object Placement defaults?
Using Pages 5.5.2 (w Yosemite). Wondering if there's any way to set a default preference for the Text Wrap and Object Placement parameters in the Format > Arrange tab? For example, more often than not I need to have Text Wrap set to "None", rather t
-
Throwing fault message WebProxy generated over webservices
I have a requirement to throw fault message when ever there is any exception caught in webservice. I have written a xsd for Fault Type and using the same in all webservices. But the problem is when generating webProxy it is generating multiple Fault
-
My customer wanted me to add some google analytics to some of their pages. So I tried to make an editable area just above the </body> tag so that I could put the specific code on just some of their pages. But when I did this, it put <!-- InstanceEnd
-
I wish to place a form on my iweb site which can be filled out online by a visitor and then emailed using the email me button. How do I do this?
-
Restore iPad from Windows 7 file location
Is there a way to restore previous backup from Windows 7 sync folder to the iPad? Thanks