UITableView: set different background colors for header and the table
I would like to set my background color for my UITableView to white and set my tableViewHeader backgroundColor to grayColor similar to the facebook app. When I bounce scroll my table so that you can see above the header, then currently it is white above the header view. I want that to be brown instead.
In the facebook app, above the headerview, it is a blue color and below the table is a white color. If i try and set the UITableView backgroundColor to brown, then the top will be brown, but so will the bottom. Additionally, all of the unset cells will have a brown background instead of white.
Any help with this?
Fixed..
Similar Messages
-
How to set cell background color for JCheckBox renderer in JTable?
I need to display table one row with white color and another row with customized color.
But Boolean column cannot set color background color.
Here is my codes.
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.table.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.TreeSet;
public class BooleanTable extends JFrame
Object[][] data = {{Boolean.TRUE},{Boolean.TRUE},{Boolean.TRUE},{Boolean.TRUE},{Boolean.TRUE},{Boolean.TRUE}};
String[] header = {"CheckBoxes"};
public BooleanTable()
setDefaultCloseOperation( EXIT_ON_CLOSE );
TableModel model = new AbstractTableModel()
public String getColumnName(int column)
return header[column].toString();
public int getRowCount()
return data.length;
public int getColumnCount()
return header.length;
public Class getColumnClass(int columnIndex)
return( data[0][columnIndex].getClass() );
public Object getValueAt(int row, int col)
return data[row][col];
public boolean isCellEditable(int row, int column)
return true;
public void setValueAt(Object value, int row, int col)
data[row][col] = value;
fireTableCellUpdated(row, col);
JTable table = new JTable(model);
table.setDefaultRenderer( Boolean.class, new MyCellRenderer() );
getContentPane().add( new JScrollPane( table ) );
pack();
setLocationRelativeTo( null );
setVisible( true );
public static void main( String[] a )
try
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
catch( Exception e )
new BooleanTable();
private class MyCellRenderer extends JCheckBox implements TableCellRenderer
public MyCellRenderer()
super();
setHorizontalAlignment(SwingConstants.CENTER);
public Component getTableCellRendererComponent(JTable
table, Object value, boolean isSelected, boolean
hasFocus, int row, int column)
if (isSelected) {
setForeground(Color.white);
setBackground(Color.black);
} else {
setForeground(Color.black);
if (row % 2 == 0) {
setBackground(Color.white);
} else {
setBackground(new Color(239, 245, 217));
setSelected( Boolean.valueOf( value.toString() ).booleanValue() );
return this;
}Instead of extending JCheckBox, extend JPanel... put a checkbox in it. (border layout center).
Or better yet, don't extend any gui component. This keeps things very clean. Don't extend a gui component unless you have no other choice.
private class MyCellRenderer implements TableCellRenderer {
private JPanel _panel = null;
private JCheckBox _checkBox = null;
public MyCellRenderer() {
// Create & configure the gui components we need
_panel = new JPanel( new BorderLayout() );
_checkBox = new JCheckBox();
_checkBox.setHorizontalAlignment( SwingConstants.CENTER );
// Layout the gui
_panel.add( _checkBox, BorderLayout.CENTER );
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
if( isSelected ) {
_checkBox.setForeground(Color.white);
_panel.setBackground(Color.black);
} else {
_checkBox.setForeground(Color.black);
if( row % 2 == 0 ) {
_panel.setBackground(Color.white);
} else {
_panel.setBackground(new Color(239, 245, 217));
_checkBox.setSelected( Boolean.valueOf( value.toString() ).booleanValue() );
return _panel;
} -
FormatType="number" sets different background color too
Hi all!
I have an af:table element and af:column inside that has formatType="number" to get the right-justified text. But beside right aligning the column values the column becomes gray. I don't like having text columns white and number columns gray in the same table. Is this a deliberate feature?
I would like to set the background color to white, but background-color property for this column is not considered. If I set the background-color property for af_outputText inside this column I also don't get the desired look.
Thanks!
Take care!Hi Frank!
I've created ADF read-only table for my view object. If I run the page immediately after this, all columns are white with gray headers which is OK. Then I change only the formatType property for one column:
<af:column sortProperty="Mass"
sortable="false"
headerText="#{bindings.MyView.labels.Mass}"
formatType="number">
<af:outputText value="#{row.Mass}">
<f:convertNumber groupingUsed="false"
pattern="#{bindings.MyView.formats.Mass}"/>
</af:outputText>
</af:column>This makes the text in this column to be right aligned but also the column becomes gray.
Hope to hear some more suggestions from you.
Thanks, bye! -
Different Background Colors for Clients
Maybe this isn't the right forum for this but how do you change the background color of ECC to change based on the client you select?
Hello,
As far as I know the colour settings are user based. On the top of SAP screen you will have a button with options, where you can change colour of the screen. If you want to get the colour of the screen based on the SAP, please speak to basis team and they should able to help you out.
Regards,
Ravi -
TableView - different background color of header cell
Hello,
I'd like to render table view with header cell of certain background color.
I think I can use <i> IHeaderCellRenderer </i> but I can't find out how to set background color from javadoc.
Best regards,
Josef MotlTry using something like:
tableView.setStyleForCell(i, column, TableCellStyle.SUBTOTAL);
Best regards
Francisco -
I seem to be stuck in apple ID ****. First the password was expired only two minutes after I finished setting up the account and then the new password was invalid. I don't know what to try next but this is making me crazy. And I'm locked out for eight hours for too many attempts at answering questions that I never set up in the first place. I don't know what gives but something is way off. I need to set up this iPad for work but I can't get past the login.
Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased. Some glitch occured and you have to restore/erse the iPod. Y will have to restore from an existing backup if y ohave one.
iOS: Wrong passcode results in red disabled screen
If recovery mode does not work try DFU mode.
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
For how to restore:
iTunes: Restoring iOS software
To restore from backup see:
iOS: How to back up
If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
You can redownload most iTunes purchases by:
Downloading past purchases from the App Store, iBookstore, and iTunes Store -
Interactive button which sets different background colors?
Hi, I was wondering if it is possible to make a button where it is possible to change from color each time you click on it, so I can use it as a label.
The button is white in the first state, when you click on it it becomes green, when you click again it becomes orange and when clicked again it becomes red.
Is this possible? Any help is appreciated.It´s not very hard to do that kind of button in InDesign by using show/hide fields. If it´s more complicated, if there´s more colors, it may become more time consuming to make.
Here´s my quick sample, made with InDesign (open with Adobe Reader or Acrobat, as Steve mentioned, other readers won´t work that well):
https://dl.dropboxusercontent.com/u/17227987/buttons.pdf
If that´s what you are looking for, feel free to explore original InDesign file:
https://dl.dropboxusercontent.com/u/17227987/buttons.indd
Note that there´s actually 4 buttons, one for each color, they are just stacked. Button´s visibility is simply changed by a click, visible button will be hide and next color will be shown etc...
The question is what else your button is supposed to do. You can attach multiple actions to one buttons so it´s possible to make that button do something else too - when clicked.... -
How can I set my background so it repeats and the background is then square next to square?
Hard to explain but basically like that...
Do you have a Pop or IMAP mail account?
Pop mail accounts can only connect to server and see the Inbox. Emails are downloaded from server Inbox to mail account Inbox.
re: 'For example If I create a folder and move some of my mails there,'
Did you create the folder in Thunderbird or in webmail?
Do you have this setting? View > Folders > All -
Is there a way to change the font color for emailing and the signature?
Is there a way to change the font color with email signature on the iPhone and iPad?
I changed the color in Word on my laptop, emailed and copied to my signature, but it converts it back to black........Looks like you didn't get a reply on your post, but it is still a problem. Font size is supposedly changeable via "Accessibility" in Settings, but it doesn't work. You can turn on "Zoom".
-
Background color for column heading
Hi,
I have 5 columns in my report and I would like to have different background color for column headings. How can I do this in report templates?
I was looking at Column heading section-
<th class="t10ReportHeader"#ALIGNMENT# id="#COLUMN_HEADER_NAME#">#COLUMN_HEADER#</th>
How can I specify backgrund colors for all columns here?
Thanks in advanceG'day Karen,
Thanks for ur reply.
I have seen this note before, its not that the header colors have changed after latest SP was applied in our systems. Also the ABAP and JAVA stacks are in sync.
Scenario is that we are trying to set up a new Portal theme for Enterprise Reporting with some specific color codes (hex codes).
What i have observed is Characterstics Header background color is set up using the element "Background Color of Level 1 Column Heading ".
While the Background color for Key Figures header is using element "Background Color of Level 2 Column Heading ".
But the problem is element "Background Color of Level 2 Column Heading " is also used as the Background color for Standard Characterstics cell, so if we make it same the whole report of the same color, which we dont want.
Requirement is to get the same Background color for Header cells (both Char. and Key Figure headers).
Any further suggestions will be appreciated.
Thanks
CK -
Set property for background color for JButton
I am attempting to change the colors of the UI for JButton. The change does not appear to be taking. The reason appears to be that JButton, and for that matter JLabel setOpaque(false); How can I globally change this to setOpaque(true);
Second is there a way to save the default property hash table after the changes are made so that it will run the next time the program is executed.Thank you for responding. I don't feel that I have been clear in the statement of the problem. I have written a medium size desktop application(20,000 statements). I am trying to customize the color scheme by modifying the default laf properties color entries. I can modify JPanel through a put to the properties hash table. When I attempt to change the background color for JLabel and JButton it doesn't seem to take. I believe that the reason it doesn't take is because opaque(false). Is there a property that allows the overide of opaque to true or do I have to change all of the numerous JButtons in my program.
I have decided to store all changes in a file and make the changes at the point that the program initializes each time its run.
I am not looking for specific code but an approach.
I would appreciate your advice. -
Different payment term at header and item level
Hi,
In sales order(VA03) we r getting different payment term for header and item.
Eg: For header we get MZ30 and for item level MZ60.
It's only for a particular material. I have been asked to find out why? Any thoughts?
Thanks in advance
ChesatHi Lakshmi,
Where do we maintain this entry to reflect this change. -
Set Background color for headers in excel
DECLARE
v_fh UTL_FILE.file_type;
v_dir VARCHAR2 (30) := 'my dir';
v_file VARCHAR2 (30) := 'test.xls';
PROCEDURE run_query (p_sql IN VARCHAR2)
IS
v_v_val VARCHAR2 (4000);
v_n_val NUMBER;
v_d_val DATE;
v_ret NUMBER;
c NUMBER;
d NUMBER;
col_cnt INTEGER;
f BOOLEAN;
rec_tab DBMS_SQL.desc_tab;
col_num NUMBER;
BEGIN
c := DBMS_SQL.open_cursor;
-- parse the SQL statement
DBMS_SQL.parse (c, p_sql, DBMS_SQL.native);
-- start execution of the SQL statement
d := DBMS_SQL.EXECUTE (c);
-- get a description of the returned columns
DBMS_SQL.describe_columns (c, col_cnt, rec_tab);
-- bind variables to columns
FOR j IN 1 .. col_cnt
LOOP
CASE rec_tab (j).col_type
WHEN 1
THEN
DBMS_SQL.define_column (c, j, v_v_val, 4000);
WHEN 2
THEN
DBMS_SQL.define_column (c, j, v_n_val);
WHEN 12
THEN
DBMS_SQL.define_column (c, j, v_d_val);
ELSE
DBMS_SQL.define_column (c, j, v_v_val, 4000);
END CASE;
END LOOP;
-- Output the column headers
UTL_FILE.put_line (v_fh, '<ss:Row>');
FOR j IN 1 .. col_cnt
LOOP
UTL_FILE.put_line (v_fh, '<ss:Cell>');
UTL_FILE.put_line (v_fh,
'<ss:Data ss:Type="String">'
|| rec_tab (j).col_name
|| '</ss:Data>'
UTL_FILE.put_line (v_fh, '</ss:Cell>');
END LOOP;
UTL_FILE.put_line (v_fh, '</ss:Row>');
-- Output the data
LOOP
v_ret := DBMS_SQL.fetch_rows (c);
EXIT WHEN v_ret = 0;
UTL_FILE.put_line (v_fh, '<ss:Row>');
FOR j IN 1 .. col_cnt
LOOP
CASE rec_tab (j).col_type
WHEN 1
THEN
DBMS_SQL.COLUMN_VALUE (c, j, v_v_val);
UTL_FILE.put_line (v_fh, '<ss:Cell>');
UTL_FILE.put_line (v_fh,
'<ss:Data ss:Type="String">'
|| v_v_val
|| '</ss:Data>'
UTL_FILE.put_line (v_fh, '</ss:Cell>');
WHEN 2
THEN
DBMS_SQL.COLUMN_VALUE (c, j, v_n_val);
UTL_FILE.put_line (v_fh, '<ss:Cell>');
UTL_FILE.put_line (v_fh,
'<ss:Data ss:Type="Number">'
|| TO_CHAR (v_n_val)
|| '</ss:Data>'
UTL_FILE.put_line (v_fh, '</ss:Cell>');
WHEN 12
THEN
DBMS_SQL.COLUMN_VALUE (c, j, v_d_val);
UTL_FILE.put_line (v_fh,
'<ss:Cell ss:StyleID="OracleDate">'
UTL_FILE.put_line (v_fh,
'<ss:Data ss:Type="DateTime">'
|| TO_CHAR (v_d_val,
'YYYY-MM-DD"T"HH24:MI:SS'
|| '</ss:Data>'
UTL_FILE.put_line (v_fh, '</ss:Cell>');
ELSE
DBMS_SQL.COLUMN_VALUE (c, j, v_v_val);
UTL_FILE.put_line (v_fh, '<ss:Cell>');
UTL_FILE.put_line (v_fh,
'<ss:Data ss:Type="String">'
|| v_v_val
|| '</ss:Data>'
UTL_FILE.put_line (v_fh, '</ss:Cell>');
END CASE;
END LOOP;
UTL_FILE.put_line (v_fh, '</ss:Row>');
END LOOP;
DBMS_SQL.close_cursor (c);
END;
PROCEDURE start_workbook
IS
BEGIN
UTL_FILE.put_line (v_fh, '<?xml version="1.0"?>');
UTL_FILE.put_line
(v_fh,
'<ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">'
END;
PROCEDURE end_workbook
IS
BEGIN
UTL_FILE.put_line (v_fh, '</ss:Workbook>');
END;
PROCEDURE start_worksheet (p_sheetname IN VARCHAR2)
IS
BEGIN
UTL_FILE.put_line (v_fh,
'<ss:Worksheet ss:Name="' || p_sheetname || '">'
UTL_FILE.put_line (v_fh, '<ss:Table>');
END;
PROCEDURE end_worksheet
IS
BEGIN
UTL_FILE.put_line (v_fh, '</ss:Table>');
UTL_FILE.put_line (v_fh, '</ss:Worksheet>');
END;
PROCEDURE set_date_style
IS
BEGIN
UTL_FILE.put_line (v_fh, '<ss:Styles>');
UTL_FILE.put_line (v_fh, '<ss:Style ss:ID="OracleDate">');
UTL_FILE.put_line
(v_fh,
'<ss:NumberFormat ss:Format="dd/mm/yyyy\ hh:mm:ss"/>'
UTL_FILE.put_line (v_fh, '</ss:Style>');
UTL_FILE.put_line (v_fh, '</ss:Styles>');
END;
BEGIN
v_fh := UTL_FILE.fopen (v_dir, v_file, 'w', 32767);
start_workbook;
set_date_style;
start_worksheet ('OM');
run_query ('select PARTY_ID,PARTY_NAME from HZ_PARTIES
where PARTY_ID<1080');
end_worksheet;
start_worksheet ('PO');
run_query ('SELECT AGENT_ID,TYPE_LOOKUP_CODE FROM PO_HEADERS_ALL
WHERE PO_HEADER_ID<20');
end_worksheet;
end_workbook;
UTL_FILE.fclose (v_fh);
END;
Here i will get two outputs in same excel with different spread sheets,
now i want to set background color for headers i
ex:PARTY_ID,PARTY_NAME,AGENT_ID,TYPE_LOOKUP_CODE are the headers,in excel output i want background color as blue.
Please do need full help,its urgent req.Hello,
open the file in Excel and save it, just to ensure that Excel writes all the additional stuff it thinks is necessary.
Now change the background colour of the header and save the file again but with a different name.
Open both files in a text editor and look at the differences. That's what you need to change in your code.
Alternatively you can use packages like xml_spreadsheet or ExcelDocumentType, both write the same file format that you use in your code and you don't have to reinvent the wheel.
Regards
Marcus -
Setting background color for a region
Hi,
I am using apex 4.0.
I am trying to set a background color to the report region and i tried different options and did not work for me. Can someone help me with this one in setting up a background color inside a region.
Thanks,
Rik
Edited by: Rik281 on Nov 19, 2010 8:46 AMRik,
So you are asking to color every row of the region?
Have you tried making a copy of the Standard, Alternating Row Colors template and working it that way?
Jeff
Edited by: jwellsnh on Nov 19, 2010 12:18 PM -
Problem in Setting Background Color for JButton
Hi,
I am using Background color for JButton (color is selected from the customized JColorChooser created by us) where it contains the option of transparency. If we choose light color, then the background is set to JButton, but when we mouse-over the JButton, other components inside the container (JPanel) is getting displayed inside the button.
Can anyone help to sort out this problem.
Thanks in advance.Hi,
Here is the code.
DialogWrapper is JDialog and ColorEditorPane is JPanel.
DialogWrapper dlg = new DialogWrapper();
ColorEditorPane colorPanel = new ColorEditorPane();
colorPanel.setValue( _data.getTransparentColor());
dlg.showWrappedDialog( colorPanel, "color_help", "color_dialog" );
if( dlg.isOK())
Color chosenColor = (Color) colorPanel.getValue().getContent();
_data.setTransparentColor( chosenColor );
_transparentColorDisplay.setBackground( chosenColor );
_transparentColorDisplay.setOpaque( true );
this.repaint();
this.doLayout();
this.validate();
}I've several components like JCheckBox, JRadioButton, JTextField in "this".
Maybe you are looking for
-
SAP System is not assigned to the leading
Hi, I am trying to configure JOB DOCUMENTATION in "Solution Manager / JSM", under tab "SYSTEMS" when assigning "Logical Components" on the bottom of this screen there is a table "Systems", when in this part trying to ativate "Monitoring" getting foll
-
IBook G4 blacks out without warning
My sister has an iBook G4 and she tells me that she was reading something on a website and that out of nowhere, it just blacked out. She describes it as "like when someone turns off an old television". I have also tried turning it back on, but that d
-
Problem with Webservice Introspection Wizard in FB3 beta 2
The wizard finishes, and I have a nice set of AS classes from the WSDL. However, when I try and use any of the classes, I get compile errors all over the place. Apparently, the wizard creates references to custom events in the main service class like
-
Hi Gurus, i am learning Work Flow. now i am doing work flow which given <b>****************</b> the first one Building a simple Workflow application using the steps "User Decision" and "Mail". After entering Abbr as DEMOWF and Na
-
Multiple photo issues on Macbook that seem to revolve around iPhoto
Hi I'm having numerous problems when dealing with photo on my laptop and was wondering if anyone might know why. Here's some info about my software, Max OS X version 10.5.8, Safari 5.0.1, iPhoto '08 version 7.1.5., and my Java software is up to date.