Default, when searching the javadocs, JDeveloper tries to find this on the internet. To make this a local reference, goto tools | manage libraries:
php configuration “<?” versus “<?php”
Some time ago I was asked to allow developers use the short “<?” tag instead of the “<?php” on my server. The php manual clearly discourages this, especially when using code that is going to be redistributed.
On the other hand, why are both possible and if the first isn’t more dangerous then it doesn’t matter does it?
Anyway, the proper way to handle it is to change the short_open_tag = Off/On
option in php.ini
Unable to create new class in JDeveloper running Vista
When you run JDeveloper on Windows Vista you might run into several security issues. Sometimes the only solution is to turn off UAC (User Account Control). For me, it was best to install JDeveloper into my own user space, also add javadocs locally there and change the library lookups.
But at some point I was unable to create a new Java class file (on a package, right-click and select ‘new’). This was odd. After some thinking I decided to change the look and feel in the preferences back to ‘Oracle’ style instead of ‘Windows’ style. And indeed, rare but true, it worked again! UAC could be turned on again.
Maximize: JFrame setExtendedState
Reminder: when you want to maximize while using JFrame and setExtendedState you should call:
frame = new JFrame("Title"); frame.pack(); frame.setVisible(true); frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
I.e. call “setExtendedState” after setVisible.
Other font in JTable cell
While doing some research, I was looking for an efficient way to change the font inside a JTable. I have made my own TableCellRenderer’s before, but while googling I came across the following link:
http://www.exampledepot.com/egs/javax.swing.table/CustRend.html
Beside the fact I wanted to make a certain cell italic, the last few lines somehow intrigued me to find out more about the author of this Java Developers Almanac, which is Patrick Chan. Great book, but not really my kinda book. Anyway, here is the TableCellRenderer which can be used to create a column in a JTable which has an italic font (thus another font, which I was looking for) :
import java.awt.Component; import java.awt.Font; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.table.TableCellRenderer; public class TableCellRenderer_Italic extends JLabel implements TableCellRenderer { // used to pad the cell when it does not have focus protected static Border normalBorder = new EmptyBorder(1, 1, 1, 1); public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if(isSelected) { setForeground(table.getSelectionForeground()); setBackground(table.getSelectionBackground()); } else { setForeground(table.getForeground()); setBackground(table.getBackground()); } if(hasFocus) { setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); } else { setBorder(normalBorder); } setFont(new Font(this.getFont().getName(), Font.ITALIC, this.getFont().getSize())); setText(value.toString()); return this; } // the following methods overide the defaults for performance reasons, lines thanks to Patrick Chan public void validate() {} public void revalidate() {} protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {} public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {} }
Note: to use it in another class:
private TableCellRenderer itaRenderer = new TableCellRenderer_Italic(); myTable.getColumnModel().getColumn(3).setCellRenderer(itaRenderer);