Strange Text Behaviour
Hi there,
So strange text behaviour here: http://screencast.com/t/atGbhTznY. I think the video is self explanatory. In Photoshop CS5 it shows the text size properly,
Desired effect or defect ?
Regards,
SK
Pattie,
Not to answer for Simeon, but this is different behavior in PsCS6. Say you scale two text layers (for example- 10 pt scaled 200%) and commit the scale. When you target each layer individually, the pt size reflects the scale (so it will appear around 20 pt). However. if you target BOTH text layers the font size is indicated as 10 pt - the original size before the scale. One would expect if you target 2 text layers of same font and size, the Character Panel would show the correct size, as happens in PsCS5.
Steps to reproduce:
Open default RGB 8 bit document.
Select Type tool at default settings 12pt type. Type a word and commit type.
Type another word at same font and commit (you’ll now have two text layers, same font and size)
Target both text layers and Edit>Transform>Scale 200%. Commit the transform.
When each layer is targeted individually, the Type Tool Option bar (or Character Panel) shows the new, scaled size of 24pt
Shift click to target both the 24pt text layers… now Type Tool Option bar reverts to show 12 pt.
Expected behavior: that the Option Bar would show the new pt size of the two layers.
Similar Messages
-
Strange Text Behaviour [HELP]
I have a movie clip that contains a multiline text field. It has about 20 lines of text. Each line numbered.
1. kjlkjasldkjlaskjlaskjd
2. klasjlaksjdlaksdj
3. kajshdkajhsdkjahsdkh
etc.
For some reason .. the entire first line of text disappears and then randomly comes back when you scroll it off screen.
So when you scroll it off screen and then bring it back in to view.. the text starts at 2. kjahskdjhasdkjha
if you keep scrolling up and down for a bit, line 1 just randomly comes back.
I have no idea whats causing this.
Any ideas ?I'm beginning to think this is a bug - in the last fortnight I've had 3 people at the office ask me how to switch this off and they've all sworn blind that they didn't switch this feature on to begin with.
Is there a key combination they are accidentally hitting which is switching this feature on? =0) -
Hi everybody,
on my MacBookPro Mid2010 I get a strange graphics behaviour:
The screen sometimes looks like this:
http://www.apfeltalk.de/forum/attachments/78146d1324206564-macbook-pro-grafikfeh ler-screenshot.jpg
(This is not my own image, but my issue looks exactly the same!)
Has anyone ever seen this?
Does someone know, why it appears?
Or things I can do against it?You can see this problem on my video : http://youtu.be/fvKaRJZlVco. With this problem Apple change my motherboard for free. I hope this video will help you.
The problem happens when your macbook pro 15 core i7 mid-2010 passes the intel graphics card to nvidia 330M graphics card with iPhoto for example.
Apple text :
http://support.apple.com/kb/TS4088
Sorry for my bad english. -
After I installed Snow Leopard, Safari renders specific pages and part of pages - strange.
http://yfrog.com/53screenshot20090929at173p
I noticed that behaviour whenever I open files like css, txt, js or every content that is not HTML page. In this example picture the strange text is wrapped with code tag. Funny thing is that if I copy/paste that strange text into TextEdit as PlainText - it will look OK!
I tried running Safari in 32 bit mode and even using Rosetta. In some cases there is no strange text, actually there is no text at all!
FireFox, for example, has no problem with this, as I tested.
What could be a problem here and how should I fix this?sceleski -
Check out this thread.
It's your Courier font, I believe.
http://discussions.apple.com/message.jspa?messageID=10309531#10309531 -
Very strange text on screen - Server 10.2.8
One place I work has a Mac network based around a G4 1.25 Ghz server running 10.2.8 Server and some Mk II iMacs running normal 10.2.8. Yesterday when I came in the server was showing a black screen with the following text scrolling down the screen in great lines:
diskOs9; Ox5 (UNDEFINED) <- written down in haste, I think I got the O as a letter not a number 0
... touching mouse or keyboard added further strange text and then it would return to the above.
Totday it all seems happy. But somehow I doubt if this is healthy. Any advice greatly appreciated. I'm trying to persuade the outgoing CEO not to set in train the acquisition of PCs, if only because I genuinely think it would end up costing more in the long run, and the place is hard up already!
I'm also wondering if the batteries on these machines are getting old - the network dates from 2003. Some of the last saved dates on the server are definitely totally wrong. Moreover there are strange things happening too; last week my files were dated things like 1911, 1942 etc etc, this week they are perfectly OK.
Getting worried![I got a black screen telling me I had to reboot in many languages, what was it?|http://www.dslreports.com/faq/4970] Also has detailed description of what happens during a KP.
[Apple docs: What's a kernel panic? (Mac OS X)|http://docs.info.apple.com/article.html?artnum=106227]
[Topic : kmosx: Kernel Panics? Don't panic too !|http://discussions.apple.com/thread.jspa?threadID=121923]
[X-Lab: Resolving Kernel Panics|http://www.thexlab.com/faqs/kernelpanics.html]
[Tutorial: Avoiding and eliminating Kernel panics|http://www.macfixit.com/article.php?story=20060911080447777]
[Tutorial: An introduction to reading Mac OS X crash reports|http://www.macfixit.com/article.php?story=20060309075929717]
[12-Step Program to Isolate Freezes and/or Kernel Panics|http://macosg.com/group/viewtopic.php?t=800]
[Texas Mac Man's post on kernel panics|http://discussions.apple.com/thread.jspa?threadID=1723768&tstart=0] -
Strange text display in pdf using adobe reader exported by Indesign CS5
Hi there,
I have export an interactive pdf from indesign CS5 PC version with version 7 update, and it looks fine in most of the PC and Mac Adobe reader.
But 2 of the computer had strange text display. One is the iMAC with latest version of Adobe Reader
<== you can see the text "78" and "454" are abnormal
But with the same computer using Safari with perview plugin is showing following result:
<==you can see the text are normal.
The pdf is embedded with following fonts and property:
Another Windows XP with Adobe Acrobat 9 will had same display as the iMac.
I ensure the Windows XP don't have the font installed with HelveticaNeue and the Mac is using OS Lion Bundle with that font.
Now the customer blame it is the problem of the pdf created by me and I had no idea how to explain to my customer and find out solution.
I had a trial version of CC but same result and no error during the export.
Any idea is highly appreciate. The customer hotline and the live chat is hopeless as they send me to this community to ask since I use CS5 not the latest version.
Regards,
IchiThanks Willi,
I had the fonts of Helvetica Neue bold light etc which created by Adobe and the font was created in 1993,shown in font property.
my PDF output is set to interactive not the print one. Other settings are default.
the purpose of this PDF is for user to print out and read on website. The funny thing is print out had no problem at all with HP and Ricoh printer using PCL 6 driver.
Despite Safari, the strange font happened in only Adobe product, other PDF reader had no problem such as foxit reader, xchange reader.
I tried to not embed the font but not able to do indesign, search in Google, it said it always embedded. Also that font family is preloaded in Mac OS.
I can try any test if there is a way to find out the solution.
or what should I do so the PDF should display correctly in all computer
thanks a lot. -
Hi,
I have a 3G S Iphone I just got last week. While using it this week it came to my attention that sometimes when I replied to an email that had a lot of activity (reply after reply, etc) strange text would appear on top of what I wrote. An example is the following,
References: <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <00f401ca19 e4$c0706630$41513290$ @ com.mx> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]>Content-Type: multipart/alternative;boundary=Apple-Mail-3--1026370481Content-Transfer-Encodin g: 7bitMime-Version: 1.0 (iPhone Mail 7A341)Date: Tue, 11 Aug 2009 12:20:49 -0500Cc:
[List of emails I replyed to]
OriginalArrivalTime: 11 Aug 2009 17:21:12.0114 (UTC) FILETIME=[1FA3D920:01CA1AA8] --Apple-Mail-3--1026370481Content-Type: text/plain;charset=utf-8;format=flowed;delsp=yesContent-Transfer-Encoding: quoted-printable
Then the text would appear.
Anyone have an idea of what is going on?
I haven't seen it happen when I reply to someone directly.
ThanksSo an update..
I took out the battery and reseated it. Simply blew on the connectors, not sure if it did anything. I plugged the battery back in and connected it to my PC and viola. Apple logo appears on the screen.
The phone boots up and displays the no sim error (I had removed the sim card) and starts to sync to iTunes. It gets mostly synced then this happened:
So... It sat like that for about two minutes before shutting itself off again. It is once again being completely unresponsive. I tried reseating the battery again but it hasn't helped.
Please, if anybody has any suggestions, let me know. Thank you!
-edit-
I've managed to get the phone into recovery mode and doing a full restore right now as a new device. I'm beginning to think the lock button has something to do with this entire issue. It may be that it's stuck down somehow without the actual hardware part being stuck? -
Strange memory behaviour using the System.Collections.Hashtable in object reference
Dear all,
Recently I came across a strange memory behaviour when comparing the system.collections.hashtable versus de scripting.dictionary object and thought to analyse it a bit in depth. First I thought I incorrectly destroyed references to the class and
child classes but even when properly destroying them (and even implemented a "SafeObject" with deallocate method) I kept seeing strange memory behaviour.
Hope this will help others when facing strange memory usage BUT I dont have a solution to the problem (yet) suggestions are welcome.
Setting:
I have a parent class that stores data in child classes through the use of a dictionary object. I want to store many differenct items in memory and fetching or alteging them must be as efficient as possible using the dictionary ability of retrieving key
/ value pairs. When the child class (which I store in the dictionary as value) contains another dictionary object memory handeling is as expected where all used memory is release upon the objects leaving scope (or destroyed via code). When I use a system.collection.hashtable
no memory is released at all though apears to have some internal flag that marks it as useable for another system.collection.hashtable object.
I created a small test snippet of code to test this behaviour with (running excel from the Office Plus 2010 version) The snippet contains a module to instantiate the parent class and child classes that will contain the data. One sub will test the Hash functionality
and the other sub will test the dictionary functionality.
Module1
Option Explicit
Sub testHash()
Dim Parent As parent_class
Dim d_Count As Double
'Instantiate parent class
Set Parent = New parent_class
'Create a child using the hash collection object
Parent.AddChildHash "TEST_hash"
Dim d_CycleCount As Double
d_CycleCount = 50000
'Add dummy data records to the child container with x amount of data For d_Count = 0 To d_CycleCount
Parent.ChildContainer("TEST_hash").InsertDataToHash CStr(d_Count), "dummy data"
Next
'Killing the parent when it goes out of scope should kill the childs. (Try it out and watch for the termination debug messages)
'According to documentation and debug messages not really required!
Set Parent.ChildContainer("TEST_hash") = Nothing
'According to documentation not really as we are leaving scope but just to be consistent.. kill the parent!
Set Parent = Nothing
End Sub
Sub testDict()
Dim Parent As parent_class
Dim d_Count As Double
'Instantiate parent class
Set Parent = New parent_class
'Create a child using the dictionary object
Parent.AddChildDict "TEST_dict"
Dim d_CycleCount As Double
d_CycleCount = 50000
'Blow up the memory with x amount of records
Dim s_SheetCycleCount As String
s_SheetCycleCount = ThisWorkbook.Worksheets("ButtonSheet").Range("K2").Value
If IsNumeric(s_SheetCycleCount) Then d_CycleCount = CDbl(s_SheetCycleCount)
'Add dummy data records to the child container
For d_Count = 0 To d_CycleCount
Parent.ChildContainer("TEST_dict").InsertDataToDict CStr(d_Count), "dummy data"
Next
'Killing the parent when it goes out of scope should kill the childs. (Try it out and watch for the termination debug messages)
'According to documentation and debug messages not really required!
Set Parent.ChildContainer("TEST_dict") = Nothing
'According to documentation not really as we are leaving scope but just to be consistent.. kill the parent!
Set Parent = Nothing
End Sub
parent_class:
Option Explicit
Public ChildContainer As Object
Private Counter As Double
Private Sub Class_Initialize()
Debug.Print "Parent initialized"
Set ChildContainer = CreateObject("Scripting.dictionary")
End Sub
Public Sub AddChildHash(ByRef ChildKey As String)
If Not ChildContainer.Exists(ChildKey) Then
Dim TmpChild As child_class_hashtable
Set TmpChild = New child_class_hashtable
ChildContainer.Add ChildKey, TmpChild
Counter = Counter + 1
Set TmpChild = Nothing
End If
End Sub
Public Sub AddChildDict(ByRef ChildKey As String)
If Not ChildContainer.Exists(ChildKey) Then
Dim TmpChild As child_class_dict
Set TmpChild = New child_class_dict
ChildContainer.Add ChildKey, TmpChild
Counter = Counter + 1
Set TmpChild = Nothing
End If
End Sub
Private Sub Class_Terminate()
Debug.Print "Parent being killed, first kill all childs (if there are any left!) - muahaha"
Set ChildContainer = Nothing
Debug.Print "Parent killed"
End Sub
child_class_dict
Option Explicit
Public MemmoryLeakObject As Object
Private Sub Class_Initialize()
Debug.Print "Child using Scripting.Dictionary initialized"
Set MemmoryLeakObject = CreateObject("Scripting.Dictionary")
End Sub
Public Sub InsertDataToDict(ByRef KeyValue As String, ByRef DataValue As String)
If Not MemmoryLeakObject.Exists(KeyValue) Then MemmoryLeakObject.Add KeyValue, DataValue
End Sub
Private Sub Class_Terminate()
Debug.Print "Child using Scripting.Dictionary terminated"
Set MemmoryLeakObject = Nothing
End Sub
child_class_hash:
Option Explicit
Public MemmoryLeakObject As Object
Private Sub Class_Initialize()
Debug.Print "Child using System.Collections.Hashtable initialized"
Set MemmoryLeakObject = CreateObject("System.Collections.Hashtable")
End Sub
Public Sub InsertDataToHash(ByRef KeyValue As String, ByRef DataValue As String)
If Not MemmoryLeakObject.ContainsKey(KeyValue) Then MemmoryLeakObject.Add KeyValue, DataValue
End Sub
Private Sub Class_Terminate()
Debug.Print "Child using System.Collections.Hashtable terminated"
Set MemmoryLeakObject = Nothing
End Sub
Statistics:
TEST: (Chronologically ordered)
1.1 Excel starting memory: 25.324 kb approximately
Max memory usage after hash (500.000 records) 84.352 kb approximately
Memory released: 0 %
1.2 max memory usages after 2nd consequtive hash usage 81.616 kb approximately
"observation:
- memory is released then reused
- less max memory consumed"
1.3 max memory usages after 3rd consequtive hash usage 80.000 kb approximately
"observation:
- memory is released then reused
- less max memory consumed"
1.4 Running the dictionary procedure after any of the hash runs will start from the already allocated memory
In this case from 80000 kb to 147000 kb
Close excel, free up memory and restart excel
2.1 Excel starting memory: 25.324 kb approximately
Max memory usage after dict (500.000 records) 90.000 kb approximately
Memory released: 91,9%
2.2 Excel starting memory 2nd consequtive dict run: 27.552 kb approximately
Max memory usage after dict (500.000 records) 90.000 kb approximately
Memory released: 99,4%
2.3 Excel starting memory 3rd consequtive dict run: 27.712 kb approximately
Max memory usage after dict (500.000 records) 90.000 kb approximately
Memory released:Hi Cor,
Thank you for going through my post and took the time to reply :) Most apreciated. The issue I am facing is that the memory is not reallocated when using mixed object types and is not behaving the same. I not understand that .net versus the older methods
use memory allocation differently and perhaps using the .net dictionary object (in stead of the scripting.dictionary) may lead to similar behaviour. {Curious to find that out -> put to the to do list of interesting thingies to explore}
I agree that allocated memory is not a bad thing as the blocks are already assigned to the program and therefore should be reallocated with more performance. However the dictionary object versus hashtable perform almost identical (and sometimes even favor
the dictionary object)
The hashtable is clearly the winner when dealing with small sets of data.
The issue arises when I am using the hash table in conjunction with another type, for example a dictionary, I see that the dictionary object's memory is stacked on top of the claimed memory space of the hashtable. It appears that .net memory allocation and
reuse is for .net references only. :) (Or so it seems)
In another example I got with the similar setup, I see that the total used memory is never released or reclaimed and leakage of around 20% allocated memory remains to eventually crash the system with the out of memory message. (This is when another class
calls the parent class that instantiates the child class but thats not the point of the question at hand)
This leakage drove me to investigate and create the example of this post in the first place. For the solution with the class -> parent class -> child class memory leak I switched all to dictionaries and no leakage occurs anymore but nevertheless thought
it may be good to share / ask if anyone else knows more :D (Never to old to learn something new) -
Strange Finder behaviour since installing Mountain Lion
I've been experiencing some strange finder behaviour since updating to Mountain Lion. Folders take several seconds to open after clicking on them (and sometimes won't open at all) and files cannot be moved around the desktop or dragged on to an app. However, it is possible to open a file by clicking on it. I've tried re-booting with Snow Leopard and everything seems OK, but as soon as I go back to ML, the problem starts again.
Library is a folder, not a file. There're more than one Library folders, one at the root and one for each user in your Mac. All of them are hidden, this is why you can't find them. But you can see their contents using
Finder Menu > Go > Go to Folder
And then type:
~/Library
for your Library Folder
-or-
/Library
for the root Library folder. -
Strange repaint behaviour with JList & Keyboard actions
Hi everyone,
This is my first post to the forum. You guys have been a great help in the past and I hope to contribute more in the future.
Anyways, I've encountered some strange repainting behaviour with a JDialog that uses a JList and a JButton. The dialog is fairly straight-forward and basically this is how it works (like an open file dialog - yes I'm implementing my own filechooser of sorts):
* JList lists a number of simple items that the user can select from.
* Once a selection is made, an Open button (JButton) is enabled.
* <ENTER> key is registered (using registerKeyboardAction()) with a JPanel which is used as the main content pane in the dialog.
* The user can either click on the Open Button or hit the <ENTER> key which then closes the dialog and runs whatever logic that needs to.
Now, the repaint problem comes in when:
1. User selects an item.
2. User hits the <ENTER> button
3. Dialog closes
4. User brings the dialog back up. This entails reloading the list by removing all elements from the list and adding new ones back in.
5. Now... if the user uses the mouse to select an item lower in the list than what was done in step #1, the selection is made, but the JList doesn't repaint to show that the new selection was made.
I didn't include a code sample because the dialog setup is totally straight-forward and I'm not doing anything trick (I've been doing this kind of thing for years now).
If I remove the key registration for the <ENTER> key from the dialog, this problem NEVER happens. Has anyone seen anything like this? It's a minor problem since my workaround is to use a ListSelectionListener which manually calls repaint() on the JList inside the valueChanged() method.
Just curious,
HuyOh, my bad. I'm actually using a JToggleButton and not a JButton, so the getRootPane().setDefaultButton() doesn't apply because it only takes JButton as an input param. I wonder why it wasn't implemented to take AbstractButton. hmmm.
-
Strange layout behaviour with TilePane
here is the demo
1.rootLayout have 2 child,controlbox and contentLayout
2.3 button on controlbox
3.contentLayout will add content,when press deffrent button on controlbox
4.watch button "Add TilePane" , strange layout behaviour , what is the matter?
layout picture
|--------------------------------|
| | |
| | |
| | |
| | |
|controlbox | contentLayout |
| (VBox) | (StackPane) |
| | |
| | |
| | |
| | |
|--------------------------------|
the code
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.TilePane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class testTilePaneLayout extends Application {
StackPane contentLayout = new StackPane();
//add content with 2 Button
public void addContent(){
VBox vbox = new VBox();
contentLayout.getChildren().clear();
contentLayout.getChildren().add(vbox);
StackPane.setAlignment(vbox,Pos.CENTER);
Button btn = new Button("Button1");
Button btn2= new Button("Button2");
vbox.getChildren().add(btn);
vbox.getChildren().add(btn2);
//add content with 2 Button & 1 ListView
public void addListViewContent(){
VBox vbox = new VBox();
contentLayout.getChildren().clear();
contentLayout.getChildren().add(vbox);
StackPane.setAlignment(vbox,Pos.CENTER);
Button btn = new Button("Button1");
Button btn2= new Button("Button2");
vbox.getChildren().add(btn);
vbox.getChildren().add(btn2);
@SuppressWarnings("rawtypes")
ListView listView = new ListView();
vbox.getChildren().add(listView);
//add content with 2 Button & 1 TilePane
public void addTilePaneContent(){
VBox vbox = new VBox();
contentLayout.getChildren().clear();
contentLayout.getChildren().add(vbox);
StackPane.setAlignment(vbox,Pos.CENTER);
Button btn = new Button("Button1");
Button btn2= new Button("Button2");
vbox.getChildren().add(btn);
vbox.getChildren().add(btn2);
TilePane tilePane = new TilePane();
tilePane.setMaxSize(100,100);
Label lbl = new Label("Label on TilePane");
tilePane.getChildren().add(lbl);
vbox.getChildren().add(tilePane);
public void start(Stage stage) {
stage.setResizable(false);
stage.centerOnScreen();
Group root = new Group();
Scene scene = new Scene(root,800,600);
stage.setScene(scene);
//root Layout = StackPane
StackPane rootLayout = new StackPane();
root.getChildren().add(rootLayout);
rootLayout.setMinSize(800,600);
rootLayout.setMaxSize(800,600);
//content StackPane
rootLayout.getChildren().add(contentLayout);
contentLayout.setMinSize(100, 100);
contentLayout.setMaxSize(200, 200);
StackPane.setAlignment(contentLayout,Pos.CENTER);
//control VBox
VBox controlBox = new VBox();
rootLayout.getChildren().add(controlBox);
controlBox.setMaxSize(100, 200);
StackPane.setAlignment(controlBox,Pos.CENTER_LEFT);
//3 control button
Button btn1 = new Button("Add button");
Button btn2= new Button("Add Listview");
Button btn3= new Button("Add TilePane");
controlBox.getChildren().add(btn1);
controlBox.getChildren().add(btn2);
controlBox.getChildren().add(btn3);
btn1.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent arg0) {
addContent();
btn2.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent arg0) {
addListViewContent();
btn3.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent arg0) {
addTilePaneContent();
stage.show();
public static void main(String[] args) {
Application.launch(args);
}Edited by: noregister on Oct 4, 2011 11:30 AM
Edited by: noregister on Oct 4, 2011 11:31 AMOh, my bad. I'm actually using a JToggleButton and not a JButton, so the getRootPane().setDefaultButton() doesn't apply because it only takes JButton as an input param. I wonder why it wasn't implemented to take AbstractButton. hmmm.
-
Strange JTable behaviour - everything is highlighted
Hello all,
im experiencing some strange JTable behaviour, and im not so sure why. When i run my program, the JTable appears, but all the cells are highlighted in advance. Also, i can now only select one cell at a time. I have set myTable.setSelectionModeListSelectionModel.SINGLE_INTERVAL_SELECTION); myTable.setCellSelectionEnabled(true);and my renderer code is below. I call the renderer by using the setDefaultRenderer method with(Object.class,myRenderer).
I have also changed isCellEditable to return true. If i dont use Object.class, and try to use my own custom class, the JTable is not all highlighted, but it doesnt seem to use myRenderer, and when i click on the header of Column A, all cells from column B and beyond become highlight, which is not normal behaviour. I thought the colum you selected should be highlighted.
Sorry for the long post, i hope the above makes sense...this is really quite bizzare, and im not so sure why this is happening. Thanks for any advice you can give, regards, Rupz
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.border.*;
import java.awt.Component;
import java.awt.Color;
import java.awt.Rectangle;
import java.util.*;
import java.awt.*;
public class MyTableCellRenderer extends DefaultTableCellRenderer{
private Font cellFont;
private LineBorder selectBorder;
private EmptyBorder emptyBorder;
public MyTableCellRenderer() {
super();
setOpaque(true);
emptyBorder = new EmptyBorder(1, 2, 1, 2);
cellFont = new Font("Times", Font.PLAIN, 10);
setFont(cellFont);
selectBorder = new LineBorder(Color.red);
private boolean isHeaderCell(int row, int column){return column == 0;}
public Component getTableCellRendererComponent (JTable myTable, Object value, boolean isSelected, boolean hasFocus, int row, int column){
//super.getTableCellRendererComponent(myTable, value, isSelected, hasFocus,row, column);
if (isSelected){
super.setForeground(myTable.getSelectionForeground());
super.setBackground(myTable.getSelectionBackground());
setBorder(selectBorder);
else{
super.setForeground(myTable.getSelectionForeground());
super.setBackground(myTable.getSelectionBackground());
setBorder(emptyBorder);
if (hasFocus) {
setBorder(selectBorder);
if (myTable.isCellEditable(row,column)) {
super.setForeground(UIManager.getColor("Table.focusCellForeground"));
super.setBackground(UIManager.getColor("Table.focusCellBackground"));
else {setBorder(noFocusBorder);}
setValue(value, isSelected, hasFocus, row, column);
// Color bDis = getBackground();
// boolean colourEquals = (bDis != null) && (bDis.equals(myTable.getBackground()) ) & myTable.isOpaque();
// setOpaque (!colourEquals);
return this;
public void setValue (Object value, boolean hasFocus, boolean isSelected, int row, int column){
if (value instanceof myCell){
myCell foo = (myCell)value;
Object data = foo.getValue(row,column);
if (isHeaderCell(row, column)) {
//label cells are center aligned
setHorizontalAlignment(JTextField.CENTER);
}else {
if (data instanceof Number) {
//numbers are right justified
setHorizontalAlignment(JTextField.RIGHT);
}else {
//everything else is left justified
setHorizontalAlignment(JTextField.LEFT);
//value to display in table
setText((data == null) ? "" : data.toString());
else {
//not cell object so render with toString of that object
setText((value == null) ? "" : value.toString());Hi VV!
thanks for the reply - now the table isnt all highlight when loaded, but as for cell celection..thats a different matter. I did have myTable.setCellSelectionEnabled(true); but no, the cell behaviour is really, eally weird, quite hard to explain, but here goes.
If i try to select cell D1 and D2 - D1 is selected, D2, E2,F2 and so on become selected. If i try to add D3 to the mix, the entire row 3 is selected, and as soon as i let go of the mouse button, the entire table except row 1 gets selected. really really weird. Below is my tableModel and what i do to the table. Thanks for your help,
regards
Rupz
myTable.setModel(new myTableModel(this,40,40));
// Create a row-header to display row numbers.
// This row-header is made of labels whose Borders,
// Foregrounds, Backgrounds, and Fonts must be
// the one used for the table column headers.
// Also ensure that the row-header labels and the table
// rows have the same height.
numRows = myTable.getColumnCount();
numCols = myTable.getRowCount();
TableColumn aColumn = myTable.getColumnModel().getColumn(0);
TableCellRenderer aRenderer = myTable.getTableHeader().getDefaultRenderer();
Component aComponent = aRenderer.getTableCellRendererComponent(myTable, aColumn.getHeaderValue(), false, false, -1, 0);
Font aFont = aComponent.getFont();
Color aBackground = aComponent.getBackground();
Color aForeground = aComponent.getForeground();
Border border = (Border)UIManager.getDefaults().get("TableHeader.cellBorder");
FontMetrics metrics = getFontMetrics(cellFont);
* Creating a panel to be used as the row header.
* Since I'm not using any LayoutManager,
* a call to setPreferredSize().
JPanel pnl = new JPanel((LayoutManager)null);
Dimension dim = new Dimension( 40, rowHeight*numRows);
pnl.setPreferredSize(dim);
// Adding the row header labels
dim.height = rowHeight;
for (int ii=0; ii<numRows; ii++) {
JLabel lbl = new JLabel(Integer.toString(ii+1), SwingConstants.CENTER);
lbl.setFont(aFont);
lbl.setBackground(aBackground);
lbl.setForeground(aForeground);
lbl.setBorder(border);
lbl.setBounds(0, ii*dim.height, dim.width, dim.height);
pnl.add(lbl);
JViewport vp = new JViewport();
dim.height = rowHeight*numRows;
vp.setViewSize(dim);
vp.setView(pnl);
// Set resize policy and make sure
// the table's size is tailored
// as soon as it gets drawn.
myTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
Dimension dimScpViewport = myTable.getPreferredScrollableViewportSize();
if (numRows>30) dimScpViewport.height = 30*rowHeight;
else dimScpViewport.height = numRows*rowHeight;
if (numCols>15)
dimScpViewport.width = 15*myTable.getColumnModel().getTotalColumnWidth()/numCols;
else
dimScpViewport.width = myTable.getColumnModel().getTotalColumnWidth();
myTable.setPreferredScrollableViewportSize(dimScpViewport);
myTable.repaint();
And the table model
public class myTableModel extends DefaultTableModel {
private MySpread mySpreadsheet;
public myTableModel (MySpread aSpreadsheet){
super();
mySpreadsheet = aSpreadsheet;
public myTableModel (MySpread aSpreadsheet, int rows,int cols){
super(rows,cols);
// for(int x = 0; x < rows; x++) {
// myCell temp = new myCell(new Integer(x+1));
// super.setValueAt(temp, x, 0);
for(int x =0 ; x < rows; x++)
for (int y = 0; y < cols; y++)
// we initialize it here
super.setValueAt(new myCell(rows,cols,("")),x,y);
mySpreadsheet = aSpreadsheet;
public boolean isCellEditable(int row, int column) {return true;}
-
Strange POF behaviour in 3.6.1.3
Hi All,
We have been seeing some strange POF behaviour in 3.6.1.3 paricularly around classes with boolean fields.
Here is my test case:
package org.gridman.pof;
import com.rbs.odc.dashboard.server.cluster.model.Case;
import com.tangosol.io.pof.ConfigurablePofContext;
import com.tangosol.io.pof.PofReader;
import com.tangosol.io.pof.PofWriter;
import com.tangosol.io.pof.PortableObject;
import com.tangosol.io.pof.reflect.PofValue;
import com.tangosol.io.pof.reflect.PofValueParser;
import com.tangosol.io.pof.reflect.SimplePofPath;
import com.tangosol.util.Binary;
import com.tangosol.util.ExternalizableHelper;
import java.io.IOException;
public class JK implements PortableObject {
private String stringField;
private boolean booleanFieldOne;
private boolean booleanFieldTwo;
public JK() {
public JK(boolean booleanFieldOne, boolean booleanFieldTwo, String stringField) {
this.booleanFieldOne = booleanFieldOne;
this.booleanFieldTwo = booleanFieldTwo;
this.stringField = stringField;
@Override
public void readExternal(PofReader pofReader) throws IOException {
stringField = pofReader.readString(0);
booleanFieldOne = pofReader.readBoolean(1);
booleanFieldTwo = pofReader.readBoolean(2);
@Override
public void writeExternal(PofWriter pofWriter) throws IOException {
pofWriter.writeString(0, stringField);
pofWriter.writeBoolean(1, booleanFieldOne);
pofWriter.writeBoolean(2, booleanFieldTwo);
public static void main(String[] args) {
ConfigurablePofContext pofContext = new ConfigurablePofContext("jk-pof-config.xml");
JK value = new JK(false, true, "JK");
Binary binary = ExternalizableHelper.toBinary(value, pofContext);
PofValue pofValue = PofValueParser.parse(binary, pofContext);
PofValue childOne = new SimplePofPath(0).navigate(pofValue);
PofValue childTwo = new SimplePofPath(1).navigate(pofValue);
PofValue childThree = new SimplePofPath(2).navigate(pofValue);
System.out.println(childOne.getValue());
try {
System.out.println(childTwo.getValue());
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
try {
System.out.println(childThree.getValue());
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
}and the jk-pof-config.xml file used above...
<pof-config>
<user-type-list>
<include>coherence-pof-config.xml</include>
<user-type>
<type-id>3001</type-id>
<class-name>org.gridman.pof.JK</class-name>
</user-type>
</user-type-list>
</pof-config>When you run the main method of the class above you would expect to get
JK
false
true... but what you get is...
JK
null
Exception: -34 is an invalid typeWhat is going on? The booleanFieldOne seems to have been serialized as type -34 which is PofConstants.V_BOOLEAN_TRUE which makes sense but the code to deserialize the field cannot handle type -34. The booleanFieldTwo comes back as null and is serialized as type -65 which is PofConstants.T_UNKNOWN
Where this causes us a problem is if we do a query with a filter like this...
new EqualsFilter(new PofExtractor(null, 1), true);...it will break whenever it tries to extract the POF value where booleanFieldOne is true.
I know we can fix this by always specifying the type, so this will work
new EqualsFilter(new PofExtractor(Boolean.class, 1), true);and this will work too wheras it fails without specifying the type...
childTwo.getValue(Boolean.class);So although there are work-arounds it seems very strange.
What is even stranger is that if you do not serialize the stringField so the readExternal and writeExtrnal methods look like this
@Override
public void readExternal(PofReader pofReader) throws IOException {
//stringField = pofReader.readString(0);
booleanFieldOne = pofReader.readBoolean(1);
booleanFieldTwo = pofReader.readBoolean(2);
@Override
public void writeExternal(PofWriter pofWriter) throws IOException {
//pofWriter.writeString(0, stringField);
pofWriter.writeBoolean(1, booleanFieldOne);
pofWriter.writeBoolean(2, booleanFieldTwo);
}The you get this output...
null
false
Exception: -34 is an invalid typeiNow the stringField is null (as we have not serialized it) but the booleanFieldOne is now being desrialized correctly as a boolean false. We have noticed that if you have a boolean as the first field you serialize in the writeExternal method then it is serialized as POF type -11 which is PofConstants.T_BOOLEAN and will be deserialized as the correct true or false value.
Cheers,
JKHi René,
Just changing the field types to Boolean like this...
private Boolean booleanFieldOne;
private Boolean booleanFieldTwo;made no difference. But then changing the writeExternal method to use writeObject instead of writeBoolean did fix it and the types of both fields are -11 or PofConstants.T_BOOLEAN
@Override
public void writeExternal(PofWriter pofWriter) throws IOException {
pofWriter.writeString(0, stringField);
pofWriter.writeObject(1, booleanFieldOne);
pofWriter.writeObject(2, booleanFieldTwo);
}So using writeObject instead of writeBoolean would be another fix, but obviously most people would pick writeBoolean to store a boolean value.
JK -
Strange JFRAME behaviour under Jdk 1.5
I have the following extracted code :
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.geom.*;
public class DrawPie extends JFrame{
private HashMap ColourMap=new HashMap();;
private HashMap DataMap=new HashMap();
private double Total_Val=0;
private int startAngle=0;
private int arcAngle=0;
public DrawPie(HashMap DataMap){
super ("Pie Chart Analysis");
this.DataMap=DataMap;
// System.out.println("DATAMap-->"+DataMap);
// getContentPane().setBackground(Color.white);
setSize(500,500);
setVisible(true);
public void paint(Graphics g){
super.paint (g);
Graphics2D g2 = (Graphics2D) g;
DrawPieChart(g);
This programme work fine under jdk1.4.2 or below at the time when the Jframe or windows is resized or icon minimised or maximised.
But when it was compiled using latest jdk1.5 , unexpected strange result happen , the pie chart draw using java 2d
g2.fill(new Arc2D.Double(30, 30, 200,200,startAngle,arcAngle
, Arc2D.PIE));
wil behaved strangely, the moment the JFrame or windows is resize or dragged.
The pie chart will disappear if the windows is resized , However if the window is minimised and restore back to normal size , pie chart will reappear and subsequently lost completely if the windows is dragged resulted in the size changes.
I was puzzled by this strange swing behaviour , any resized or windows minimise or maximise would not result in the lost of pie chart as long as the jdk is not 1.5 ! Was it due to swing fundamental changes incorporated in the latest release?
Any suggestion?
Thankok I see what you have done,
now a few tips in drawing something on your frame:
never override the paint method of your main Frame (like you did)
to draw something on it you simply override the contentPane's paint method
and to make your own contentPane you simply make one by making a new Class
that extends say JPanel and assign it as a contentPane of your Frame(like I did)
And in this Paint method you can draw whatever you like it will be properly uptated!!!
All the best keep up the good work!
ps. try the code bellow.
import javax.swing.*;
public class DrawPie1 extends JFrame {
private double Total_Val=0;
private int startAngle=0;
private int arcAngle=0;
private MyMainPanel mainPan;
public DrawPie1()
super ("Pie Chart Analysis");
mainPan = new MyMainPanel();
setContentPane(mainPan);
//public void paint(Graphics g) //Do not override the paint method of your main frame!!
// super.paint (g);
// Graphics2D g2 = (Graphics2D) g;
// g2.setPaint(Color.red);
// g2.fill(new Arc2D.Double(30, 30, 200,200,0,78
// , Arc2D.PIE));
public static void main(String args[])
DrawPie1 pie=new DrawPie1();
pie.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pie.setSize(400,300);
pie.setVisible(true);
//**** Second Class
import javax.swing.*;
import java.awt.*;
import java.awt.geom.Arc2D;
public class MyMainPanel extends JPanel
public MyMainPanel()
public void paint(Graphics g)
super.paint (g);
Graphics2D g2 = (Graphics2D) g;
g2.setPaint(Color.red);
g2.fill(new Arc2D.Double(30, 30, 200,200,0,78
, Arc2D.PIE));
} -
Sourcing 7.0 - Strange Login Behaviour for enterprise user
Hello
We have installed SAP Sourcing 7.0 and created one tenant and after that everything was running fine. I have now created another tenant. After this there is a strange login behaviour for enterprise user
When I go to the ...../fsbuyer/portal URL, it given me a login screen. When I try to login with enterprise user and password as specified in the context, it does not let me login even with a correct password. The error is "User Authentication Failed"
I just happened to try NW CE Administrator Login, after this the error changed to "Entry does not exist". Here I gave enterprise user and password and it logged into the system. So I now have to login two times once with NW UME User and other with enterprise user to access the setup page.
However this is the problem only for enteprise user and not for other user accounts that I created. I checked in NW UME, the enterprise user does not exist there. However I can see that other users that I created using "Internal User Accounts" are also created in NW UME.
Anyone faced this behaviour earlier?
This also brings out a very interesting point. In Multi-Tenant Setup when using NW UME does this mean that two tenants cannot share the same user account. Is that so?
Regards,
ShubhamHi Vikram,
Thanks a ton for your reponse.
I would like to understand your solution regarding creating another cluster.
Does this mean I need to install another CE Instance and install sourcing on the same.
OR
I have to create an Add-In instance for the current CE Server and define the Host Name of Add-In Instance in the new cluster
Also in this cluster, which context should I select, System Context or Existing Tenant Context or New Tenant Context.
Regards,
Shubham
Maybe you are looking for
-
I have just updated itunes on my pc (windows XP) to the latest version. When I try to open it I get an error message saying the application failed to start because MSVCR80.dll was not found< Have tried reinstalling with no luck. Any ideas?
-
Hyper-V Remote Admin on a Domain - Failed to connect to root\cimv2
I'm trying to configure our Hyper-V server so that a user on our domain has administrative control. Our Hyper-V server is on the domain running 2008 R2 (named SERVER85 below), and the client is on Win 7 Ent x64 (named DEV03 below, username accuraty\
-
Alternate drives in Jar file Class-Path attribute
Hello, all. I am working on a project that I would like to package into a single jar file for simple execution. At my place of work classes from EJB are stored on a different drive from where I am doing the development. I am having trouble accessing
-
Splash screen does not come up for 11.1.2 install
Will probably put in a ticket with Oracle but just wanted to float this by you all... W2K8 R2 64bit placed the assemblies in the correct order and the install log verifies them but I am getting a weird error on failure to launch splash screen. Log be
-
In the past I was able to shuffle just a playlist and nothing else, and now it is gone. My question is "Is it possible to shuffle a playlist but not the rest of my music." Or is this one of the many apps that has hit the "All Or Nothing Floor"